From 47acf0aa9ca2294568fa1272363620b3065ceb4d Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Thu, 23 Jul 2020 18:12:49 -0700 Subject: [PATCH 001/123] feat: first library generation --- .../.repo-metadata.json | 13 ++ .../google-cloud-functions/CODE_OF_CONDUCT.md | 43 ++++ .../google-cloud-functions/CONTRIBUTING.md | 66 ++++++ packages/google-cloud-functions/LICENSE | 202 ++++++++++++++++++ packages/google-cloud-functions/README.md | 122 +++++++++++ .../__pycache__/synth.cpython-37.pyc | Bin 0 -> 783 bytes packages/google-cloud-functions/synth.py | 32 +++ 7 files changed, 478 insertions(+) create mode 100644 packages/google-cloud-functions/.repo-metadata.json create mode 100644 packages/google-cloud-functions/CODE_OF_CONDUCT.md create mode 100644 packages/google-cloud-functions/CONTRIBUTING.md create mode 100644 packages/google-cloud-functions/LICENSE create mode 100644 packages/google-cloud-functions/README.md create mode 100644 packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc create mode 100644 packages/google-cloud-functions/synth.py diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json new file mode 100644 index 00000000000..be436fb8111 --- /dev/null +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -0,0 +1,13 @@ +{ + "name": "nodejs-functions", + "name_pretty": "Google Cloud Functions", + "product_documentation": "https://developers.google.com/nodejs-functions/", + "client_documentation": "https://googleapis.dev/nodejs/nodejs-functions/latest/index.html", + "issue_tracker": "", + "release_level": "alpha", + "language": "nodejs", + "repo": "googleapis/nodejs-functions", + "distribution_name": "@google-cloud/functions", + "api_id": "cloudfunctions.googleapis.com", + "requires_billing": false +} \ No newline at end of file diff --git a/packages/google-cloud-functions/CODE_OF_CONDUCT.md b/packages/google-cloud-functions/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..db0f99159da --- /dev/null +++ b/packages/google-cloud-functions/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version> +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2> diff --git a/packages/google-cloud-functions/CONTRIBUTING.md b/packages/google-cloud-functions/CONTRIBUTING.md new file mode 100644 index 00000000000..d13489ce7c9 --- /dev/null +++ b/packages/google-cloud-functions/CONTRIBUTING.md @@ -0,0 +1,66 @@ +# How to become a contributor and submit your own code + +**Table of contents** + +* [Contributor License Agreements](#contributor-license-agreements) +* [Contributing a patch](#contributing-a-patch) +* [Running the tests](#running-the-tests) +* [Releasing the library](#releasing-the-library) + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement +(CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google> + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the code to which + you are contributing. +1. Ensure that your code has an appropriate set of tests which all pass. +1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) stylin> +1. Submit a pull request. + +## Running the tests + +1. [Prepare your environment for Node.js setup][setup]. + +1. Install dependencies: + + npm install + +1. Run the tests: + + # Run unit tests. + npm test + + # Run sample integration tests. + gcloud auth application-default login + npm run samples-test + + # Run all system tests. + gcloud auth application-default login + npm run system-test + +1. Lint (and maybe fix) any changes: + + npm run fix + +[setup]: https://cloud.google.com/nodejs/docs/setup + diff --git a/packages/google-cloud-functions/LICENSE b/packages/google-cloud-functions/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-functions/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md new file mode 100644 index 00000000000..eb2175432a0 --- /dev/null +++ b/packages/google-cloud-functions/README.md @@ -0,0 +1,122 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Cloud Functions: Node.js Client](https://github.com/googleapis/nodejs-functions) + +[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![npm version](https://img.shields.io/npm/v/@google-cloud/functions.svg)](https://www.npmjs.org/package/@google-cloud/functions) +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-functions/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-functions) + + + + +Functions client for Node.js + + +* [Cloud Functions Node.js Client API Reference][client-docs] +* [Cloud Functions Documentation][product-docs] +* [github.com/googleapis/nodejs-functions](https://github.com/googleapis/nodejs-functions) + +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 Functions API][enable_api]. +1. [Set up authentication with a service account][auth] so you can access the + API from your local workstation. + +### Installing the client library + +```bash +npm install @google-cloud/functions +``` + + + + + +The [Cloud Functions Node.js Client API Reference][client-docs] documentation +also contains samples. + +## Supported Node.js Versions + +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). +Libraries are compatible with all current _active_ and _maintenance_ versions of +Node.js. + +Client libraries targetting some end-of-life versions of Node.js are available, and +can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. + +_Legacy Node.js versions are supported as a best effort:_ + +* Legacy versions will not be tested in continuous integration. +* Some security patches may not be able to be backported. +* Dependencies will not be kept up-to-date, and features will not be backported. + +#### Legacy tags available + +* `legacy-8`: install client libraries from this dist-tag for versions + compatible with Node.js 8. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + + + +This library is considered to be in **beta**. This means it is expected to be +mostly stable while we work toward a general availability release; however, +complete stability is not guaranteed. We will address issues and requests +against beta libraries with a high priority. + + + + +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/nodejs-functions/blob/master/CONTRIBUTING.md). + +Please note that this `README.md`, the `samples/README.md`, +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) +are generated from a central template. To edit one of these files, make an edit +to its template in this +[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). + +## License + +Apache Version 2.0 + +See [LICENSE](https://github.com/googleapis/nodejs-functions/blob/master/LICENSE) + +[client-docs]: https://googleapis.dev/nodejs/functions/latest/index.html +[product-docs]: https://cloud.google.com/functions/docs +[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=cloudfunctions.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc b/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81cd26378c1d7717a70a796681ae6f60f80e8b31 GIT binary patch literal 783 zcmYL{!ET#C5QcX#1aM;Gq)FT4P@x_w`A}QES5;#tN+ZQdBx6-wwL*AzOt2P~vJl07 zhrB~_?6r@Bdh4mL&{G#`JB#*b=3{1O7#Or#O{CWJ@W}tABlNp+*2_@FN44coB@7Y7 zFw;0DT77TCI??feX2e?>!YDS0xgr*^z?$1?H(BEzE2@)i&>wal5os|a#H7u(h;#P_ z+9&ASE7F11!!9_`dDMsl+I$b35Ha&!!|40h&q!rHQ`5}2C{S1ywL24u7ZH-rSTAXhvMvRt}i=H^ur zkEU6WEqZ^{yQ9l4E)5R1z&)bfz9aUmNN663M5+fC+)-XIkV|`7M4a_yM!OB-NKs@I zd@g8Eg_hPWWU|U34ue@x@Z4XK?u*j&eI}^ymv-G-E(9;JB(06t3u#IkmArgnJV?SK z2toD|!GPEsztk&Gnp}iol!WE>G>{P;iewgrrEzjPn4FQLk@BI4W z)E{1rM(5s`G|!H&&xeCx37i;VkVZ69e+MGwYAmI>YMtyHyphS*Q$VJc*vW`cs0eqC#Q+z*tsRn=Pl_WBd42H2Nk76lwc(pSUiSJmh8 t?dE&*>*4g$MQOc{1uHmwsE&}YmFU>QJ9tlN8&~$0(q=_8OIdAo{R6lB>5%{c literal 0 HcmV?d00001 diff --git a/packages/google-cloud-functions/synth.py b/packages/google-cloud-functions/synth.py new file mode 100644 index 00000000000..0dc2845ce1a --- /dev/null +++ b/packages/google-cloud-functions/synth.py @@ -0,0 +1,32 @@ +# 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. +"""This script is used to synthesize generated parts of this library.""" +import synthtool as s +import synthtool.gcp as gcp +import synthtool.languages.node as node +import logging +logging.basicConfig(level=logging.DEBUG) +AUTOSYNTH_MULTIPLE_COMMITS = True +gapic = gcp.GAPICBazel() +versions = ['v1'] +library = 'functions' +for version in versions: + library = gapic.node_library(library, version) + s.copy(library, excludes=[]) +# Copy common templates +common_templates = gcp.CommonTemplates() +templates = common_templates.node_library( + source_location='build/src', versions=['v1'], default_version='v1') +s.copy(templates, excludes=[]) +node.postprocess_gapic_library() \ No newline at end of file From 8ee6982b995c02840cc72995be569eb1834a9f8f Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Thu, 23 Jul 2020 18:31:46 -0700 Subject: [PATCH 002/123] feat: run synthtool --- packages/google-cloud-functions/.eslintignore | 6 + .../google-cloud-functions/.eslintrc.json | 3 + .../google-cloud-functions/.gitattributes | 4 + packages/google-cloud-functions/.gitignore | 14 + packages/google-cloud-functions/.jsdoc.js | 55 + packages/google-cloud-functions/.mocharc.js | 28 + packages/google-cloud-functions/.nycrc | 24 + .../google-cloud-functions/.prettierignore | 6 + .../google-cloud-functions/.prettierrc.js | 17 + .../google-cloud-functions/CODE_OF_CONDUCT.md | 4 +- .../google-cloud-functions/CONTRIBUTING.md | 5 +- packages/google-cloud-functions/README.md | 26 +- .../google-cloud-functions/api-extractor.json | 369 + .../linkinator.config.json | 10 + packages/google-cloud-functions/package.json | 64 + .../google/cloud/functions/v1/functions.proto | 615 + .../cloud/functions/v1/operations.proto | 65 + .../google-cloud-functions/protos/protos.d.ts | 8691 +++++++ .../google-cloud-functions/protos/protos.js | 21703 ++++++++++++++++ .../google-cloud-functions/protos/protos.json | 2157 ++ packages/google-cloud-functions/src/index.ts | 26 + .../src/v1/cloud_functions_service_client.ts | 1425 + ...cloud_functions_service_client_config.json | 70 + .../cloud_functions_service_proto_list.json | 4 + .../google-cloud-functions/src/v1/index.ts | 19 + .../google-cloud-functions/synth.metadata | 37 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 25 + .../system-test/install.ts | 49 + .../test/gapic_cloud_functions_service_v1.ts | 1516 ++ packages/google-cloud-functions/tsconfig.json | 19 + .../google-cloud-functions/webpack.config.js | 64 + 32 files changed, 37128 insertions(+), 19 deletions(-) create mode 100644 packages/google-cloud-functions/.eslintignore create mode 100644 packages/google-cloud-functions/.eslintrc.json create mode 100644 packages/google-cloud-functions/.gitattributes create mode 100644 packages/google-cloud-functions/.gitignore create mode 100644 packages/google-cloud-functions/.jsdoc.js create mode 100644 packages/google-cloud-functions/.mocharc.js create mode 100644 packages/google-cloud-functions/.nycrc create mode 100644 packages/google-cloud-functions/.prettierignore create mode 100644 packages/google-cloud-functions/.prettierrc.js create mode 100644 packages/google-cloud-functions/api-extractor.json create mode 100644 packages/google-cloud-functions/linkinator.config.json create mode 100644 packages/google-cloud-functions/package.json create mode 100644 packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto create mode 100644 packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto create mode 100644 packages/google-cloud-functions/protos/protos.d.ts create mode 100644 packages/google-cloud-functions/protos/protos.js create mode 100644 packages/google-cloud-functions/protos/protos.json create mode 100644 packages/google-cloud-functions/src/index.ts create mode 100644 packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts create mode 100644 packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json create mode 100644 packages/google-cloud-functions/src/v1/cloud_functions_service_proto_list.json create mode 100644 packages/google-cloud-functions/src/v1/index.ts create mode 100644 packages/google-cloud-functions/synth.metadata create mode 100644 packages/google-cloud-functions/system-test/fixtures/sample/src/index.js create mode 100644 packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts create mode 100644 packages/google-cloud-functions/system-test/install.ts create mode 100644 packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts create mode 100644 packages/google-cloud-functions/tsconfig.json create mode 100644 packages/google-cloud-functions/webpack.config.js diff --git a/packages/google-cloud-functions/.eslintignore b/packages/google-cloud-functions/.eslintignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-functions/.eslintignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-functions/.eslintrc.json b/packages/google-cloud-functions/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-functions/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-functions/.gitattributes b/packages/google-cloud-functions/.gitattributes new file mode 100644 index 00000000000..33739cb74e4 --- /dev/null +++ b/packages/google-cloud-functions/.gitattributes @@ -0,0 +1,4 @@ +*.ts text eol=lf +*.js text eol=lf +protos/* linguist-generated +**/api-extractor.json linguist-language=JSON-with-Comments diff --git a/packages/google-cloud-functions/.gitignore b/packages/google-cloud-functions/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-functions/.gitignore @@ -0,0 +1,14 @@ +**/*.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/packages/google-cloud-functions/.jsdoc.js b/packages/google-cloud-functions/.jsdoc.js new file mode 100644 index 00000000000..1a5a5a31296 --- /dev/null +++ b/packages/google-cloud-functions/.jsdoc.js @@ -0,0 +1,55 @@ +// 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. +// +// ** This file 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 2020 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/functions', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-functions/.mocharc.js b/packages/google-cloud-functions/.mocharc.js new file mode 100644 index 00000000000..ff7b34fa5d1 --- /dev/null +++ b/packages/google-cloud-functions/.mocharc.js @@ -0,0 +1,28 @@ +// 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. +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/packages/google-cloud-functions/.nycrc b/packages/google-cloud-functions/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /dev/null +++ b/packages/google-cloud-functions/.nycrc @@ -0,0 +1,24 @@ +{ + "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 +} diff --git a/packages/google-cloud-functions/.prettierignore b/packages/google-cloud-functions/.prettierignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-functions/.prettierignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-functions/.prettierrc.js b/packages/google-cloud-functions/.prettierrc.js new file mode 100644 index 00000000000..d1b95106f4c --- /dev/null +++ b/packages/google-cloud-functions/.prettierrc.js @@ -0,0 +1,17 @@ +// 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. + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/packages/google-cloud-functions/CODE_OF_CONDUCT.md b/packages/google-cloud-functions/CODE_OF_CONDUCT.md index db0f99159da..46b2a08ea6d 100644 --- a/packages/google-cloud-functions/CODE_OF_CONDUCT.md +++ b/packages/google-cloud-functions/CODE_OF_CONDUCT.md @@ -39,5 +39,5 @@ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version> -available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2> +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/packages/google-cloud-functions/CONTRIBUTING.md b/packages/google-cloud-functions/CONTRIBUTING.md index d13489ce7c9..f6c4cf010e3 100644 --- a/packages/google-cloud-functions/CONTRIBUTING.md +++ b/packages/google-cloud-functions/CONTRIBUTING.md @@ -16,7 +16,7 @@ Please fill out either the individual or corporate Contributor License Agreement (CLA). * If you are an individual writing original source code and you're sure you - own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google> + own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual). * If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate). @@ -34,7 +34,7 @@ accept your pull requests. 1. Ensure that your code adheres to the existing style in the code to which you are contributing. 1. Ensure that your code has an appropriate set of tests which all pass. -1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) stylin> +1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling. 1. Submit a pull request. ## Running the tests @@ -63,4 +63,3 @@ accept your pull requests. npm run fix [setup]: https://cloud.google.com/nodejs/docs/setup - diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index eb2175432a0..d7d089aa35c 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -2,9 +2,9 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Cloud Functions: Node.js Client](https://github.com/googleapis/nodejs-functions) +# [Google Cloud Functions: Node.js Client](https://github.com/googleapis/nodejs-functions) -[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/functions.svg)](https://www.npmjs.org/package/@google-cloud/functions) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-functions/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-functions) @@ -14,8 +14,8 @@ Functions client for Node.js -* [Cloud Functions Node.js Client API Reference][client-docs] -* [Cloud Functions Documentation][product-docs] +* [Google Cloud Functions Node.js Client API Reference][client-docs] +* [Google Cloud Functions Documentation][product-docs] * [github.com/googleapis/nodejs-functions](https://github.com/googleapis/nodejs-functions) Read more about the client libraries for Cloud APIs, including the older @@ -40,8 +40,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. ### Before you begin 1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Cloud Functions API][enable_api]. +1. [Enable the Google Cloud Functions API][enable_api]. 1. [Set up authentication with a service account][auth] so you can access the API from your local workstation. @@ -55,7 +54,7 @@ npm install @google-cloud/functions -The [Cloud Functions Node.js Client API Reference][client-docs] documentation +The [Google Cloud Functions Node.js Client API Reference][client-docs] documentation also contains samples. ## Supported Node.js Versions @@ -85,11 +84,10 @@ This library follows [Semantic Versioning](http://semver.org/). -This library is considered to be in **beta**. This means it is expected to be -mostly stable while we work toward a general availability release; however, -complete stability is not guaranteed. We will address issues and requests -against beta libraries with a high priority. +This library is considered to be in **alpha**. This means it is still a +work-in-progress and under active development. Any release is subject to +backwards-incompatible changes at any time. @@ -113,10 +111,10 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-functions/blob/master/LICENSE) -[client-docs]: https://googleapis.dev/nodejs/functions/latest/index.html -[product-docs]: https://cloud.google.com/functions/docs +[client-docs]: https://googleapis.dev/nodejs/nodejs-functions/latest/index.html +[product-docs]: https://developers.google.com/nodejs-functions/ [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=cloudfunctions.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-functions/api-extractor.json b/packages/google-cloud-functions/api-extractor.json new file mode 100644 index 00000000000..de228294b23 --- /dev/null +++ b/packages/google-cloud-functions/api-extractor.json @@ -0,0 +1,369 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for + * standard settings to be shared across multiple projects. + * + * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains + * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be + * resolved using NodeJS require(). + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "extends": "./shared/api-extractor-base.json" + // "extends": "my-package/include/api-extractor-base.json" + + /** + * Determines the "" token that can be used with other config file settings. The project folder + * typically contains the tsconfig.json and package.json config files, but the path is user-defined. + * + * The path is resolved relative to the folder of the config file that contains the setting. + * + * The default value for "projectFolder" is the token "", which means the folder is determined by traversing + * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder + * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error + * will be reported. + * + * SUPPORTED TOKENS: + * DEFAULT VALUE: "" + */ + // "projectFolder": "..", + + /** + * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor + * analyzes the symbols exported by this module. + * + * The file extension must be ".d.ts" and not ".ts". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + */ + "mainEntryPointFilePath": "/protos/protos.d.ts", + + /** + * A list of NPM package names whose exports should be treated as part of this package. + * + * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", + * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part + * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly + * imports library2. To avoid this, we can specify: + * + * "bundledPackages": [ "library2" ], + * + * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been + * local files for library1. + */ + "bundledPackages": [ ], + + /** + * Determines how the TypeScript compiler engine will be invoked by API Extractor. + */ + "compiler": { + /** + * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * Note: This setting will be ignored if "overrideTsconfig" is used. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/tsconfig.json" + */ + // "tsconfigFilePath": "/tsconfig.json", + + /** + * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. + * The object must conform to the TypeScript tsconfig schema: + * + * http://json.schemastore.org/tsconfig + * + * If omitted, then the tsconfig.json file will be read from the "projectFolder". + * + * DEFAULT VALUE: no overrideTsconfig section + */ + // "overrideTsconfig": { + // . . . + // } + + /** + * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended + * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when + * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses + * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. + * + * DEFAULT VALUE: false + */ + // "skipLibCheck": true, + }, + + /** + * Configures how the API report file (*.api.md) will be generated. + */ + "apiReport": { + /** + * (REQUIRED) Whether to generate an API report. + */ + "enabled": true, + + /** + * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce + * a full file path. + * + * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". + * + * SUPPORTED TOKENS: , + * DEFAULT VALUE: ".api.md" + */ + // "reportFileName": ".api.md", + + /** + * Specifies the folder where the API report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, + * e.g. for an API review. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/etc/" + */ + // "reportFolder": "/etc/", + + /** + * Specifies the folder where the temporary report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * After the temporary file is written to disk, it is compared with the file in the "reportFolder". + * If they are different, a production build will fail. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportTempFolder": "/temp/" + }, + + /** + * Configures how the doc model file (*.api.json) will be generated. + */ + "docModel": { + /** + * (REQUIRED) Whether to generate a doc model file. + */ + "enabled": true, + + /** + * The output path for the doc model file. The file extension should be ".api.json". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/.api.json" + */ + // "apiJsonFilePath": "/temp/.api.json" + }, + + /** + * Configures how the .d.ts rollup file will be generated. + */ + "dtsRollup": { + /** + * (REQUIRED) Whether to generate the .d.ts rollup file. + */ + "enabled": true, + + /** + * Specifies the output path for a .d.ts rollup file to be generated without any trimming. + * This file will include all declarations that are exported by the main entry point. + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/dist/.d.ts" + */ + // "untrimmedFilePath": "/dist/.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. + * This file will include only declarations that are marked as "@public" or "@beta". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "betaTrimmedFilePath": "/dist/-beta.d.ts", + + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. + * This file will include only declarations that are marked as "@public". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "publicTrimmedFilePath": "/dist/-public.d.ts", + + /** + * When a declaration is trimmed, by default it will be replaced by a code comment such as + * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the + * declaration completely. + * + * DEFAULT VALUE: false + */ + // "omitTrimmingComments": true + }, + + /** + * Configures how the tsdoc-metadata.json file will be generated. + */ + "tsdocMetadata": { + /** + * Whether to generate the tsdoc-metadata.json file. + * + * DEFAULT VALUE: true + */ + // "enabled": true, + + /** + * Specifies where the TSDoc metadata file should be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", + * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup + * falls back to "tsdoc-metadata.json" in the package folder. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" + }, + + /** + * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files + * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. + * To use the OS's default newline kind, specify "os". + * + * DEFAULT VALUE: "crlf" + */ + // "newlineKind": "crlf", + + /** + * Configures how API Extractor reports error and warning messages produced during analysis. + * + * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. + */ + "messages": { + /** + * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing + * the input .d.ts files. + * + * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "compilerMessageReporting": { + /** + * Configures the default routing for messages that don't match an explicit rule in this table. + */ + "default": { + /** + * Specifies whether the message should be written to the the tool's output log. Note that + * the "addToApiReportFile" property may supersede this option. + * + * Possible values: "error", "warning", "none" + * + * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail + * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes + * the "--local" option), the warning is displayed but the build will not fail. + * + * DEFAULT VALUE: "warning" + */ + "logLevel": "warning", + + /** + * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), + * then the message will be written inside that file; otherwise, the message is instead logged according to + * the "logLevel" option. + * + * DEFAULT VALUE: false + */ + // "addToApiReportFile": false + }, + + // "TS2551": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by API Extractor during its analysis. + * + * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" + * + * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings + */ + "extractorMessageReporting": { + "default": { + "logLevel": "warning", + // "addToApiReportFile": false + }, + + // "ae-extra-release-tag": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by the TSDoc parser when analyzing code comments. + * + * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "tsdocMessageReporting": { + "default": { + "logLevel": "warning", + // "addToApiReportFile": false + } + + // "tsdoc-link-tag-unescaped-text": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + } + } + +} diff --git a/packages/google-cloud-functions/linkinator.config.json b/packages/google-cloud-functions/linkinator.config.json new file mode 100644 index 00000000000..29a223b6db6 --- /dev/null +++ b/packages/google-cloud-functions/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json new file mode 100644 index 00000000000..87aaf1ad931 --- /dev/null +++ b/packages/google-cloud-functions/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/functions", + "version": "0.1.0", + "description": "Functions client for Node.js", + "repository": "googleapis/nodejs-functions", + "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 functions", + "functions", + "cloud functions service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "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": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.6.3" + }, + "devDependencies": { + "@types/mocha": "^8.0.0", + "@types/node": "^14.0.24", + "@types/sinon": "^9.0.4", + "c8": "^7.2.1", + "gts": "^2.0.2", + "jsdoc": "^3.6.4", + "jsdoc-fresh": "^1.0.2", + "jsdoc-region-tag": "^1.0.4", + "linkinator": "^2.1.1", + "mocha": "^8.0.1", + "null-loader": "^4.0.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^9.0.2", + "ts-loader": "^8.0.1", + "typescript": "^3.9.7", + "webpack": "^4.43.0", + "webpack-cli": "^3.3.12" + }, + "engines": { + "node": ">=10.0.0" + } +} diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto new file mode 100644 index 00000000000..aa3dd5de6ab --- /dev/null +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto @@ -0,0 +1,615 @@ +// 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.functions.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v1;functions"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v1"; +option objc_class_prefix = "GCF"; + +// A service that application uses to manipulate triggers and functions. +service CloudFunctionsService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/functions" + }; + } + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (CloudFunction) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{location=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "location,function"; + option (google.longrunning.operation_info) = { + response_type: "CloudFunction" + metadata_type: "OperationMetadataV1" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function"; + option (google.longrunning.operation_info) = { + response_type: "CloudFunction" + metadata_type: "OperationMetadataV1" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadataV1" + }; + } + + // Synchronously invokes a deployed Cloud Function. To be used for testing + // purposes as very limited traffic is allowed. For more information on + // the actual limits, refer to + // [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + rpc CallFunction(CallFunctionRequest) returns (CallFunctionResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/functions/*}:call" + body: "*" + }; + option (google.api.method_signature) = "name,data"; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * Source file size should not exceed 100MB limit. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making a HTTP PUT request, these two headers need to be specified: + // + // * `content-type: application/zip` + // * `x-goog-content-length-range: 0,104857600` + // + // And this header SHOULD NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and should be used within + // minutes after generation. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Sets the IAM access control policy on the specified function. + // Replaces any existing policy. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy" + body: "*" + }; + } + + // Gets the IAM access control policy for a function. + // Returns an empty policy if the function exists and does not have a policy + // set. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + get: "/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy" + }; + } + + // Tests the specified permissions against the IAM access control policy + // for a function. + // If the function does not exist, this will return an empty set of + // permissions, not a NOT_FOUND error. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions" + body: "*" + }; + } +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulate function and triggers configurations. +message CloudFunction { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + pattern: "projects/{project}/locations/{location}/functions/{function}" + }; + + // Available egress settings. + // + // This controls what traffic is diverted through the VPC Access Connector + // resource. By default PRIVATE_RANGES_ONLY will be used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the VPC Access Connector only for private IP space from RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of VPC Access Connector for all egress traffic from the + // function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL will be used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // User-provided description of a function. + string description = 2; + + // The location of the function source code. + oneof source_code { + // The Google Cloud Storage URL, starting with gs://, pointing to the zip + // archive which contains the function. + string source_archive_url = 3; + + // **Beta Feature** + // + // The source repository where a function is hosted. + SourceRepository source_repository = 4; + + // The Google Cloud Storage signed URL used for source uploading, generated + // by [google.cloud.functions.v1.GenerateUploadUrl][] + string source_upload_url = 16; + } + + // An event that triggers the function. + oneof trigger { + // An HTTPS endpoint type of source that can be triggered via URL. + HttpsTrigger https_trigger = 5; + + // A source that fires events in response to a condition in another service. + EventTrigger event_trigger = 6; + } + + // Output only. Status of the function deployment. + CloudFunctionStatus status = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 8; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 19; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + google.protobuf.Duration timeout = 9; + + // The amount of memory in MB available for a function. + // Defaults to 256MB. + int32 available_memory_mb = 10; + + // The email of the function's service account. If empty, defaults to + // `{project_id}@appspot.gserviceaccount.com`. + string service_account_email = 11; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The version identifier of the Cloud Function. Each deployment attempt + // results in a new version of a function being created. + int64 version_id = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 15; + + // Environment variables that shall be available during function execution. + map environment_variables = 17; + + // The VPC Network that this cloud function can connect to. It can be + // either the fully-qualified URI, or the short name of the network resource. + // If the short network name is used, the network must belong to the same + // project. Otherwise, it must belong to a project within the same + // organization. The format of this field is either + // `projects/{project}/global/networks/{network}` or `{network}`, where + // {project} is a project id where the network is defined, and {network} is + // the short name of the network. + // + // This field is mutually exclusive with `vpc_connector` and will be replaced + // by it. + // + // See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + // more information on connecting Cloud projects. + string network = 18; + + // The limit on the maximum number of function instances that may coexist at a + // given time. + int32 max_instances = 20; + + // The VPC Network Connector that this cloud function can connect to. It can + // be either the fully-qualified URI, or the short name of the network + // connector resource. The format of this field is + // `projects/*/locations/*/connectors/*` + // + // This field is mutually exclusive with `network` field and will eventually + // replace it. + // + // See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + // more information on connecting Cloud projects. + string vpc_connector = 22; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 23; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 24; + + // Output only. The Cloud Build ID of the latest successful deployment of the + // function. + string build_id = 27 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes SourceRepository, used to represent parameters related to +// source repository where a function is hosted. +message SourceRepository { + // The URL pointing to the hosted repository where the function is defined. + // There are supported Cloud Source Repository URLs in the following + // formats: + // + // To refer to a specific commit: + // `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` + // To refer to a moveable alias (branch): + // `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` + // In particular, to refer to HEAD use `master` moveable alias. + // To refer to a specific fixed alias (tag): + // `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` + // + // You may omit `paths/*` if you want to use the main directory. + string url = 1; + + // Output only. The URL pointing to the hosted repository where the function + // were defined at the time of deployment. It always points to a specific + // commit in the format described above. + string deployed_url = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes HttpsTrigger, could be used to connect web hooks to function. +message HttpsTrigger { + // Output only. The deployed url for the function. + string url = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes EventTrigger, used to request events be sent from another +// service. +message EventTrigger { + // Required. The type of event to observe. For example: + // `providers/cloud.storage/eventTypes/object.change` and + // `providers/cloud.pubsub/eventTypes/topic.publish`. + // + // Event types match pattern `providers/*/eventTypes/*.*`. + // The pattern contains: + // + // 1. namespace: For example, `cloud.storage` and + // `google.firebase.analytics`. + // 2. resource type: The type of resource on which event occurs. For + // example, the Google Cloud Storage API includes the type `object`. + // 3. action: The action that generates the event. For example, action for + // a Google Cloud Storage Object is 'change'. + // These parts are lower case. + string event_type = 1; + + // Required. The resource(s) from which to observe events, for example, + // `projects/_/buckets/myBucket`. + // + // Not all syntactically correct values are accepted by all services. For + // example: + // + // 1. The authorization model must support it. Google Cloud Functions + // only allows EventTriggers to be deployed that observe resources in the + // same project as the `CloudFunction`. + // 2. The resource type must match the pattern expected for an + // `event_type`. For example, an `EventTrigger` that has an + // `event_type` of "google.pubsub.topic.publish" should have a resource + // that matches Google Cloud Pub/Sub topics. + // + // Additionally, some services may support short names when creating an + // `EventTrigger`. These will always be returned in the normalized "long" + // format. + // + // See each *service's* documentation for supported formats. + string resource = 2; + + // The hostname of the service that should be observed. + // + // If no string is provided, the default service implementing the API will + // be used. For example, `storage.googleapis.com` is the default for all + // event types in the `google.storage` namespace. + string service = 3; + + // Specifies policy for failed executions. + FailurePolicy failure_policy = 5; +} + +// Describes the policy in case of function's execution failure. +// If empty, then defaults to ignoring failures (i.e. not retrying them). +message FailurePolicy { + // Describes the retry policy in case of function's execution failure. + // A function execution will be retried on any failure. + // A failed execution will be retried up to 7 days with an exponential backoff + // (capped at 10 seconds). + // Retried execution is charged as any other execution. + message Retry { + + } + + // Defines the action taken in case of a function execution failure. + oneof action { + // If specified, then the function will be retried in case of a failure. + Retry retry = 1; + } +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, specified + // in the format `projects/*/locations/*` + string location = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + CloudFunction function = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + CloudFunction function = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + + // Required list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + } + ]; +} + +// Describes the current stage of a deployment. +enum CloudFunctionStatus { + // Not specified. Invalid state. + CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function isn’t serving. + OFFLINE = 2; + + // Function is being created or updated. + DEPLOY_IN_PROGRESS = 3; + + // Function is being deleted. + DELETE_IN_PROGRESS = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // The project and location from which the function should be listed, + // specified in the format `projects/*/locations/*` + // If you want to list functions in all locations, use "-" in place of a + // location. When listing functions in all locations, if one or more + // location(s) are unreachable, the response will contain functions from all + // reachable locations along with the names of any unreachable locations. + string parent = 1 [(google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + }]; + + // Maximum number of functions to return per call. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated CloudFunction functions = 1; + + // If not empty, indicates that there may be more functions that match + // the request; this value should be passed in a new + // [google.cloud.functions.v1.ListFunctionsRequest][google.cloud.functions.v1.ListFunctionsRequest] + // to get more functions. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + } + ]; +} + +// Request for the `CallFunction` method. +message CallFunctionRequest { + // Required. The name of the function to be called. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + } + ]; + + // Required. Input to be passed to the function. + string data = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response of `CallFunction` method. +message CallFunctionResponse { + // Execution id of function invocation. + string execution_id = 1; + + // Result populated for successful execution of synchronous function. Will + // not be populated if function does not return a result through context. + string result = 2; + + // Either system or user-function generated error. Set if execution + // was not successful. + string error = 3; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // The project and location in which the Google Cloud Storage signed URL + // should be generated, specified in the format `projects/*/locations/*`. + string parent = 1; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // The name of function for which source code Google Cloud Storage signed + // URL should be generated. + string name = 1; + + // The optional version of function. If not set, default, current version + // is used. + uint64 version_id = 2; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto new file mode 100644 index 00000000000..053ee013256 --- /dev/null +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto @@ -0,0 +1,65 @@ +// 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.functions.v1; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v1;functions"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsOperationsProto"; +option java_package = "com.google.cloud.functions.v1"; + +// A type of an operation. +enum OperationType { + // Unknown operation type. + OPERATION_UNSPECIFIED = 0; + + // Triggered by CreateFunction call + CREATE_FUNCTION = 1; + + // Triggered by UpdateFunction call + UPDATE_FUNCTION = 2; + + // Triggered by DeleteFunction call. + DELETE_FUNCTION = 3; +} + +// Metadata describing an [Operation][google.longrunning.Operation] +message OperationMetadataV1 { + // Target of the operation - for example + // projects/project-1/locations/region-1/functions/function-1 + string target = 1; + + // Type of operation. + OperationType type = 2; + + // The original request that started the operation. + google.protobuf.Any request = 3; + + // Version id of the function created or updated by an API call. + // This field is only populated for Create and Update operations. + int64 version_id = 4; + + // The last update timestamp of the operation. + google.protobuf.Timestamp update_time = 5; + + // The Cloud Build ID of the function created or updated by an API call. + // This field is only populated for Create and Update operations. + string build_id = 6; +} diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts new file mode 100644 index 00000000000..133208b60cc --- /dev/null +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -0,0 +1,8691 @@ +// 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. + +import * as Long from "long"; +import * as $protobuf from "protobufjs"; +/** Namespace google. */ +export namespace google { + + /** Namespace cloud. */ + namespace cloud { + + /** Namespace functions. */ + namespace functions { + + /** Namespace v1. */ + namespace v1 { + + /** Represents a CloudFunctionsService */ + class CloudFunctionsService extends $protobuf.rpc.Service { + + /** + * Constructs a new CloudFunctionsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new CloudFunctionsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CloudFunctionsService; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListFunctionsResponse + */ + public listFunctions(request: google.cloud.functions.v1.IListFunctionsRequest, callback: google.cloud.functions.v1.CloudFunctionsService.ListFunctionsCallback): void; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @returns Promise + */ + public listFunctions(request: google.cloud.functions.v1.IListFunctionsRequest): Promise; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CloudFunction + */ + public getFunction(request: google.cloud.functions.v1.IGetFunctionRequest, callback: google.cloud.functions.v1.CloudFunctionsService.GetFunctionCallback): void; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @returns Promise + */ + public getFunction(request: google.cloud.functions.v1.IGetFunctionRequest): Promise; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createFunction(request: google.cloud.functions.v1.ICreateFunctionRequest, callback: google.cloud.functions.v1.CloudFunctionsService.CreateFunctionCallback): void; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @returns Promise + */ + public createFunction(request: google.cloud.functions.v1.ICreateFunctionRequest): Promise; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateFunction(request: google.cloud.functions.v1.IUpdateFunctionRequest, callback: google.cloud.functions.v1.CloudFunctionsService.UpdateFunctionCallback): void; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @returns Promise + */ + public updateFunction(request: google.cloud.functions.v1.IUpdateFunctionRequest): Promise; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteFunction(request: google.cloud.functions.v1.IDeleteFunctionRequest, callback: google.cloud.functions.v1.CloudFunctionsService.DeleteFunctionCallback): void; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @returns Promise + */ + public deleteFunction(request: google.cloud.functions.v1.IDeleteFunctionRequest): Promise; + + /** + * Calls CallFunction. + * @param request CallFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CallFunctionResponse + */ + public callFunction(request: google.cloud.functions.v1.ICallFunctionRequest, callback: google.cloud.functions.v1.CloudFunctionsService.CallFunctionCallback): void; + + /** + * Calls CallFunction. + * @param request CallFunctionRequest message or plain object + * @returns Promise + */ + public callFunction(request: google.cloud.functions.v1.ICallFunctionRequest): Promise; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + */ + public generateUploadUrl(request: google.cloud.functions.v1.IGenerateUploadUrlRequest, callback: google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrlCallback): void; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @returns Promise + */ + public generateUploadUrl(request: google.cloud.functions.v1.IGenerateUploadUrlRequest): Promise; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + */ + public generateDownloadUrl(request: google.cloud.functions.v1.IGenerateDownloadUrlRequest, callback: google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrlCallback): void; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @returns Promise + */ + public generateDownloadUrl(request: google.cloud.functions.v1.IGenerateDownloadUrlRequest): Promise; + + /** + * Calls SetIamPolicy. + * @param request SetIamPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Policy + */ + public setIamPolicy(request: google.iam.v1.ISetIamPolicyRequest, callback: google.cloud.functions.v1.CloudFunctionsService.SetIamPolicyCallback): void; + + /** + * Calls SetIamPolicy. + * @param request SetIamPolicyRequest message or plain object + * @returns Promise + */ + public setIamPolicy(request: google.iam.v1.ISetIamPolicyRequest): Promise; + + /** + * Calls GetIamPolicy. + * @param request GetIamPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Policy + */ + public getIamPolicy(request: google.iam.v1.IGetIamPolicyRequest, callback: google.cloud.functions.v1.CloudFunctionsService.GetIamPolicyCallback): void; + + /** + * Calls GetIamPolicy. + * @param request GetIamPolicyRequest message or plain object + * @returns Promise + */ + public getIamPolicy(request: google.iam.v1.IGetIamPolicyRequest): Promise; + + /** + * Calls TestIamPermissions. + * @param request TestIamPermissionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TestIamPermissionsResponse + */ + public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest, callback: google.cloud.functions.v1.CloudFunctionsService.TestIamPermissionsCallback): void; + + /** + * Calls TestIamPermissions. + * @param request TestIamPermissionsRequest message or plain object + * @returns Promise + */ + public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest): Promise; + } + + namespace CloudFunctionsService { + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#listFunctions}. + * @param error Error, if any + * @param [response] ListFunctionsResponse + */ + type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v1.ListFunctionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#getFunction}. + * @param error Error, if any + * @param [response] CloudFunction + */ + type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v1.CloudFunction) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#createFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#updateFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#deleteFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#callFunction}. + * @param error Error, if any + * @param [response] CallFunctionResponse + */ + type CallFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v1.CallFunctionResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#generateUploadUrl}. + * @param error Error, if any + * @param [response] GenerateUploadUrlResponse + */ + type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v1.GenerateUploadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#generateDownloadUrl}. + * @param error Error, if any + * @param [response] GenerateDownloadUrlResponse + */ + type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v1.GenerateDownloadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#setIamPolicy}. + * @param error Error, if any + * @param [response] Policy + */ + type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#getIamPolicy}. + * @param error Error, if any + * @param [response] Policy + */ + type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#testIamPermissions}. + * @param error Error, if any + * @param [response] TestIamPermissionsResponse + */ + type TestIamPermissionsCallback = (error: (Error|null), response?: google.iam.v1.TestIamPermissionsResponse) => void; + } + + /** Properties of a CloudFunction. */ + interface ICloudFunction { + + /** CloudFunction name */ + name?: (string|null); + + /** CloudFunction description */ + description?: (string|null); + + /** CloudFunction sourceArchiveUrl */ + sourceArchiveUrl?: (string|null); + + /** CloudFunction sourceRepository */ + sourceRepository?: (google.cloud.functions.v1.ISourceRepository|null); + + /** CloudFunction sourceUploadUrl */ + sourceUploadUrl?: (string|null); + + /** CloudFunction httpsTrigger */ + httpsTrigger?: (google.cloud.functions.v1.IHttpsTrigger|null); + + /** CloudFunction eventTrigger */ + eventTrigger?: (google.cloud.functions.v1.IEventTrigger|null); + + /** CloudFunction status */ + status?: (google.cloud.functions.v1.CloudFunctionStatus|keyof typeof google.cloud.functions.v1.CloudFunctionStatus|null); + + /** CloudFunction entryPoint */ + entryPoint?: (string|null); + + /** CloudFunction runtime */ + runtime?: (string|null); + + /** CloudFunction timeout */ + timeout?: (google.protobuf.IDuration|null); + + /** CloudFunction availableMemoryMb */ + availableMemoryMb?: (number|null); + + /** CloudFunction serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** CloudFunction updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** CloudFunction versionId */ + versionId?: (number|Long|string|null); + + /** CloudFunction labels */ + labels?: ({ [k: string]: string }|null); + + /** CloudFunction environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** CloudFunction network */ + network?: (string|null); + + /** CloudFunction maxInstances */ + maxInstances?: (number|null); + + /** CloudFunction vpcConnector */ + vpcConnector?: (string|null); + + /** CloudFunction vpcConnectorEgressSettings */ + vpcConnectorEgressSettings?: (google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings|null); + + /** CloudFunction ingressSettings */ + ingressSettings?: (google.cloud.functions.v1.CloudFunction.IngressSettings|keyof typeof google.cloud.functions.v1.CloudFunction.IngressSettings|null); + + /** CloudFunction buildId */ + buildId?: (string|null); + } + + /** Represents a CloudFunction. */ + class CloudFunction implements ICloudFunction { + + /** + * Constructs a new CloudFunction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.ICloudFunction); + + /** CloudFunction name. */ + public name: string; + + /** CloudFunction description. */ + public description: string; + + /** CloudFunction sourceArchiveUrl. */ + public sourceArchiveUrl: string; + + /** CloudFunction sourceRepository. */ + public sourceRepository?: (google.cloud.functions.v1.ISourceRepository|null); + + /** CloudFunction sourceUploadUrl. */ + public sourceUploadUrl: string; + + /** CloudFunction httpsTrigger. */ + public httpsTrigger?: (google.cloud.functions.v1.IHttpsTrigger|null); + + /** CloudFunction eventTrigger. */ + public eventTrigger?: (google.cloud.functions.v1.IEventTrigger|null); + + /** CloudFunction status. */ + public status: (google.cloud.functions.v1.CloudFunctionStatus|keyof typeof google.cloud.functions.v1.CloudFunctionStatus); + + /** CloudFunction entryPoint. */ + public entryPoint: string; + + /** CloudFunction runtime. */ + public runtime: string; + + /** CloudFunction timeout. */ + public timeout?: (google.protobuf.IDuration|null); + + /** CloudFunction availableMemoryMb. */ + public availableMemoryMb: number; + + /** CloudFunction serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** CloudFunction updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** CloudFunction versionId. */ + public versionId: (number|Long|string); + + /** CloudFunction labels. */ + public labels: { [k: string]: string }; + + /** CloudFunction environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** CloudFunction network. */ + public network: string; + + /** CloudFunction maxInstances. */ + public maxInstances: number; + + /** CloudFunction vpcConnector. */ + public vpcConnector: string; + + /** CloudFunction vpcConnectorEgressSettings. */ + public vpcConnectorEgressSettings: (google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings); + + /** CloudFunction ingressSettings. */ + public ingressSettings: (google.cloud.functions.v1.CloudFunction.IngressSettings|keyof typeof google.cloud.functions.v1.CloudFunction.IngressSettings); + + /** CloudFunction buildId. */ + public buildId: string; + + /** CloudFunction sourceCode. */ + public sourceCode?: ("sourceArchiveUrl"|"sourceRepository"|"sourceUploadUrl"); + + /** CloudFunction trigger. */ + public trigger?: ("httpsTrigger"|"eventTrigger"); + + /** + * Creates a new CloudFunction instance using the specified properties. + * @param [properties] Properties to set + * @returns CloudFunction instance + */ + public static create(properties?: google.cloud.functions.v1.ICloudFunction): google.cloud.functions.v1.CloudFunction; + + /** + * Encodes the specified CloudFunction message. Does not implicitly {@link google.cloud.functions.v1.CloudFunction.verify|verify} messages. + * @param message CloudFunction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.ICloudFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloudFunction message, length delimited. Does not implicitly {@link google.cloud.functions.v1.CloudFunction.verify|verify} messages. + * @param message CloudFunction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.ICloudFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloudFunction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloudFunction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.CloudFunction; + + /** + * Decodes a CloudFunction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloudFunction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.CloudFunction; + + /** + * Verifies a CloudFunction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloudFunction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloudFunction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.CloudFunction; + + /** + * Creates a plain object from a CloudFunction message. Also converts values to other types if specified. + * @param message CloudFunction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.CloudFunction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloudFunction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace CloudFunction { + + /** VpcConnectorEgressSettings enum. */ + enum VpcConnectorEgressSettings { + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0, + PRIVATE_RANGES_ONLY = 1, + ALL_TRAFFIC = 2 + } + + /** IngressSettings enum. */ + enum IngressSettings { + INGRESS_SETTINGS_UNSPECIFIED = 0, + ALLOW_ALL = 1, + ALLOW_INTERNAL_ONLY = 2, + ALLOW_INTERNAL_AND_GCLB = 3 + } + } + + /** Properties of a SourceRepository. */ + interface ISourceRepository { + + /** SourceRepository url */ + url?: (string|null); + + /** SourceRepository deployedUrl */ + deployedUrl?: (string|null); + } + + /** Represents a SourceRepository. */ + class SourceRepository implements ISourceRepository { + + /** + * Constructs a new SourceRepository. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.ISourceRepository); + + /** SourceRepository url. */ + public url: string; + + /** SourceRepository deployedUrl. */ + public deployedUrl: string; + + /** + * Creates a new SourceRepository instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceRepository instance + */ + public static create(properties?: google.cloud.functions.v1.ISourceRepository): google.cloud.functions.v1.SourceRepository; + + /** + * Encodes the specified SourceRepository message. Does not implicitly {@link google.cloud.functions.v1.SourceRepository.verify|verify} messages. + * @param message SourceRepository message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.ISourceRepository, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceRepository message, length delimited. Does not implicitly {@link google.cloud.functions.v1.SourceRepository.verify|verify} messages. + * @param message SourceRepository message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.ISourceRepository, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceRepository message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceRepository + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.SourceRepository; + + /** + * Decodes a SourceRepository message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceRepository + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.SourceRepository; + + /** + * Verifies a SourceRepository message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceRepository message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceRepository + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.SourceRepository; + + /** + * Creates a plain object from a SourceRepository message. Also converts values to other types if specified. + * @param message SourceRepository + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.SourceRepository, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceRepository to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HttpsTrigger. */ + interface IHttpsTrigger { + + /** HttpsTrigger url */ + url?: (string|null); + } + + /** Represents a HttpsTrigger. */ + class HttpsTrigger implements IHttpsTrigger { + + /** + * Constructs a new HttpsTrigger. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IHttpsTrigger); + + /** HttpsTrigger url. */ + public url: string; + + /** + * Creates a new HttpsTrigger instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpsTrigger instance + */ + public static create(properties?: google.cloud.functions.v1.IHttpsTrigger): google.cloud.functions.v1.HttpsTrigger; + + /** + * Encodes the specified HttpsTrigger message. Does not implicitly {@link google.cloud.functions.v1.HttpsTrigger.verify|verify} messages. + * @param message HttpsTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IHttpsTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpsTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v1.HttpsTrigger.verify|verify} messages. + * @param message HttpsTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IHttpsTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpsTrigger message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpsTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.HttpsTrigger; + + /** + * Decodes a HttpsTrigger message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpsTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.HttpsTrigger; + + /** + * Verifies a HttpsTrigger message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpsTrigger message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpsTrigger + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.HttpsTrigger; + + /** + * Creates a plain object from a HttpsTrigger message. Also converts values to other types if specified. + * @param message HttpsTrigger + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.HttpsTrigger, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpsTrigger to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EventTrigger. */ + interface IEventTrigger { + + /** EventTrigger eventType */ + eventType?: (string|null); + + /** EventTrigger resource */ + resource?: (string|null); + + /** EventTrigger service */ + service?: (string|null); + + /** EventTrigger failurePolicy */ + failurePolicy?: (google.cloud.functions.v1.IFailurePolicy|null); + } + + /** Represents an EventTrigger. */ + class EventTrigger implements IEventTrigger { + + /** + * Constructs a new EventTrigger. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IEventTrigger); + + /** EventTrigger eventType. */ + public eventType: string; + + /** EventTrigger resource. */ + public resource: string; + + /** EventTrigger service. */ + public service: string; + + /** EventTrigger failurePolicy. */ + public failurePolicy?: (google.cloud.functions.v1.IFailurePolicy|null); + + /** + * Creates a new EventTrigger instance using the specified properties. + * @param [properties] Properties to set + * @returns EventTrigger instance + */ + public static create(properties?: google.cloud.functions.v1.IEventTrigger): google.cloud.functions.v1.EventTrigger; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v1.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v1.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.EventTrigger; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.EventTrigger; + + /** + * Verifies an EventTrigger message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventTrigger + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.EventTrigger; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @param message EventTrigger + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.EventTrigger, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventTrigger to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FailurePolicy. */ + interface IFailurePolicy { + + /** FailurePolicy retry */ + retry?: (google.cloud.functions.v1.FailurePolicy.IRetry|null); + } + + /** Represents a FailurePolicy. */ + class FailurePolicy implements IFailurePolicy { + + /** + * Constructs a new FailurePolicy. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IFailurePolicy); + + /** FailurePolicy retry. */ + public retry?: (google.cloud.functions.v1.FailurePolicy.IRetry|null); + + /** FailurePolicy action. */ + public action?: "retry"; + + /** + * Creates a new FailurePolicy instance using the specified properties. + * @param [properties] Properties to set + * @returns FailurePolicy instance + */ + public static create(properties?: google.cloud.functions.v1.IFailurePolicy): google.cloud.functions.v1.FailurePolicy; + + /** + * Encodes the specified FailurePolicy message. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.verify|verify} messages. + * @param message FailurePolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IFailurePolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FailurePolicy message, length delimited. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.verify|verify} messages. + * @param message FailurePolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IFailurePolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FailurePolicy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FailurePolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.FailurePolicy; + + /** + * Decodes a FailurePolicy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FailurePolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.FailurePolicy; + + /** + * Verifies a FailurePolicy message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FailurePolicy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FailurePolicy + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.FailurePolicy; + + /** + * Creates a plain object from a FailurePolicy message. Also converts values to other types if specified. + * @param message FailurePolicy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.FailurePolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FailurePolicy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FailurePolicy { + + /** Properties of a Retry. */ + interface IRetry { + } + + /** Represents a Retry. */ + class Retry implements IRetry { + + /** + * Constructs a new Retry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.FailurePolicy.IRetry); + + /** + * Creates a new Retry instance using the specified properties. + * @param [properties] Properties to set + * @returns Retry instance + */ + public static create(properties?: google.cloud.functions.v1.FailurePolicy.IRetry): google.cloud.functions.v1.FailurePolicy.Retry; + + /** + * Encodes the specified Retry message. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.Retry.verify|verify} messages. + * @param message Retry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.FailurePolicy.IRetry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Retry message, length delimited. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.Retry.verify|verify} messages. + * @param message Retry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.FailurePolicy.IRetry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Retry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Retry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.FailurePolicy.Retry; + + /** + * Decodes a Retry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Retry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.FailurePolicy.Retry; + + /** + * Verifies a Retry message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Retry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Retry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.FailurePolicy.Retry; + + /** + * Creates a plain object from a Retry message. Also converts values to other types if specified. + * @param message Retry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.FailurePolicy.Retry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Retry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a CreateFunctionRequest. */ + interface ICreateFunctionRequest { + + /** CreateFunctionRequest location */ + location?: (string|null); + + /** CreateFunctionRequest function */ + "function"?: (google.cloud.functions.v1.ICloudFunction|null); + } + + /** Represents a CreateFunctionRequest. */ + class CreateFunctionRequest implements ICreateFunctionRequest { + + /** + * Constructs a new CreateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.ICreateFunctionRequest); + + /** CreateFunctionRequest location. */ + public location: string; + + /** CreateFunctionRequest function. */ + public function?: (google.cloud.functions.v1.ICloudFunction|null); + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v1.ICreateFunctionRequest): google.cloud.functions.v1.CreateFunctionRequest; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.CreateFunctionRequest; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.CreateFunctionRequest; + + /** + * Verifies a CreateFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.CreateFunctionRequest; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @param message CreateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.CreateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateFunctionRequest. */ + interface IUpdateFunctionRequest { + + /** UpdateFunctionRequest function */ + "function"?: (google.cloud.functions.v1.ICloudFunction|null); + + /** UpdateFunctionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateFunctionRequest. */ + class UpdateFunctionRequest implements IUpdateFunctionRequest { + + /** + * Constructs a new UpdateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IUpdateFunctionRequest); + + /** UpdateFunctionRequest function. */ + public function?: (google.cloud.functions.v1.ICloudFunction|null); + + /** UpdateFunctionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v1.IUpdateFunctionRequest): google.cloud.functions.v1.UpdateFunctionRequest; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.UpdateFunctionRequest; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.UpdateFunctionRequest; + + /** + * Verifies an UpdateFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.UpdateFunctionRequest; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @param message UpdateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.UpdateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetFunctionRequest. */ + interface IGetFunctionRequest { + + /** GetFunctionRequest name */ + name?: (string|null); + } + + /** Represents a GetFunctionRequest. */ + class GetFunctionRequest implements IGetFunctionRequest { + + /** + * Constructs a new GetFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IGetFunctionRequest); + + /** GetFunctionRequest name. */ + public name: string; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v1.IGetFunctionRequest): google.cloud.functions.v1.GetFunctionRequest; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.GetFunctionRequest; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.GetFunctionRequest; + + /** + * Verifies a GetFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.GetFunctionRequest; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @param message GetFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.GetFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** CloudFunctionStatus enum. */ + enum CloudFunctionStatus { + CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0, + ACTIVE = 1, + OFFLINE = 2, + DEPLOY_IN_PROGRESS = 3, + DELETE_IN_PROGRESS = 4, + UNKNOWN = 5 + } + + /** Properties of a ListFunctionsRequest. */ + interface IListFunctionsRequest { + + /** ListFunctionsRequest parent */ + parent?: (string|null); + + /** ListFunctionsRequest pageSize */ + pageSize?: (number|null); + + /** ListFunctionsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListFunctionsRequest. */ + class ListFunctionsRequest implements IListFunctionsRequest { + + /** + * Constructs a new ListFunctionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IListFunctionsRequest); + + /** ListFunctionsRequest parent. */ + public parent: string; + + /** ListFunctionsRequest pageSize. */ + public pageSize: number; + + /** ListFunctionsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsRequest instance + */ + public static create(properties?: google.cloud.functions.v1.IListFunctionsRequest): google.cloud.functions.v1.ListFunctionsRequest; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v1.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.ListFunctionsRequest; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.ListFunctionsRequest; + + /** + * Verifies a ListFunctionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.ListFunctionsRequest; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @param message ListFunctionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.ListFunctionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsResponse. */ + interface IListFunctionsResponse { + + /** ListFunctionsResponse functions */ + functions?: (google.cloud.functions.v1.ICloudFunction[]|null); + + /** ListFunctionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListFunctionsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListFunctionsResponse. */ + class ListFunctionsResponse implements IListFunctionsResponse { + + /** + * Constructs a new ListFunctionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IListFunctionsResponse); + + /** ListFunctionsResponse functions. */ + public functions: google.cloud.functions.v1.ICloudFunction[]; + + /** ListFunctionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListFunctionsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsResponse instance + */ + public static create(properties?: google.cloud.functions.v1.IListFunctionsResponse): google.cloud.functions.v1.ListFunctionsResponse; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v1.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v1.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.ListFunctionsResponse; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.ListFunctionsResponse; + + /** + * Verifies a ListFunctionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.ListFunctionsResponse; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @param message ListFunctionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.ListFunctionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteFunctionRequest. */ + interface IDeleteFunctionRequest { + + /** DeleteFunctionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteFunctionRequest. */ + class DeleteFunctionRequest implements IDeleteFunctionRequest { + + /** + * Constructs a new DeleteFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IDeleteFunctionRequest); + + /** DeleteFunctionRequest name. */ + public name: string; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v1.IDeleteFunctionRequest): google.cloud.functions.v1.DeleteFunctionRequest; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.DeleteFunctionRequest; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.DeleteFunctionRequest; + + /** + * Verifies a DeleteFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.DeleteFunctionRequest; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @param message DeleteFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.DeleteFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CallFunctionRequest. */ + interface ICallFunctionRequest { + + /** CallFunctionRequest name */ + name?: (string|null); + + /** CallFunctionRequest data */ + data?: (string|null); + } + + /** Represents a CallFunctionRequest. */ + class CallFunctionRequest implements ICallFunctionRequest { + + /** + * Constructs a new CallFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.ICallFunctionRequest); + + /** CallFunctionRequest name. */ + public name: string; + + /** CallFunctionRequest data. */ + public data: string; + + /** + * Creates a new CallFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CallFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v1.ICallFunctionRequest): google.cloud.functions.v1.CallFunctionRequest; + + /** + * Encodes the specified CallFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.CallFunctionRequest.verify|verify} messages. + * @param message CallFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.ICallFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CallFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.CallFunctionRequest.verify|verify} messages. + * @param message CallFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.ICallFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CallFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CallFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.CallFunctionRequest; + + /** + * Decodes a CallFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CallFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.CallFunctionRequest; + + /** + * Verifies a CallFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CallFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CallFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.CallFunctionRequest; + + /** + * Creates a plain object from a CallFunctionRequest message. Also converts values to other types if specified. + * @param message CallFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.CallFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CallFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CallFunctionResponse. */ + interface ICallFunctionResponse { + + /** CallFunctionResponse executionId */ + executionId?: (string|null); + + /** CallFunctionResponse result */ + result?: (string|null); + + /** CallFunctionResponse error */ + error?: (string|null); + } + + /** Represents a CallFunctionResponse. */ + class CallFunctionResponse implements ICallFunctionResponse { + + /** + * Constructs a new CallFunctionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.ICallFunctionResponse); + + /** CallFunctionResponse executionId. */ + public executionId: string; + + /** CallFunctionResponse result. */ + public result: string; + + /** CallFunctionResponse error. */ + public error: string; + + /** + * Creates a new CallFunctionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns CallFunctionResponse instance + */ + public static create(properties?: google.cloud.functions.v1.ICallFunctionResponse): google.cloud.functions.v1.CallFunctionResponse; + + /** + * Encodes the specified CallFunctionResponse message. Does not implicitly {@link google.cloud.functions.v1.CallFunctionResponse.verify|verify} messages. + * @param message CallFunctionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.ICallFunctionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CallFunctionResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v1.CallFunctionResponse.verify|verify} messages. + * @param message CallFunctionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.ICallFunctionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CallFunctionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CallFunctionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.CallFunctionResponse; + + /** + * Decodes a CallFunctionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CallFunctionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.CallFunctionResponse; + + /** + * Verifies a CallFunctionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CallFunctionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CallFunctionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.CallFunctionResponse; + + /** + * Creates a plain object from a CallFunctionResponse message. Also converts values to other types if specified. + * @param message CallFunctionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.CallFunctionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CallFunctionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlRequest. */ + interface IGenerateUploadUrlRequest { + + /** GenerateUploadUrlRequest parent */ + parent?: (string|null); + } + + /** Represents a GenerateUploadUrlRequest. */ + class GenerateUploadUrlRequest implements IGenerateUploadUrlRequest { + + /** + * Constructs a new GenerateUploadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IGenerateUploadUrlRequest); + + /** GenerateUploadUrlRequest parent. */ + public parent: string; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v1.IGenerateUploadUrlRequest): google.cloud.functions.v1.GenerateUploadUrlRequest; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v1.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.GenerateUploadUrlRequest; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.GenerateUploadUrlRequest; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.GenerateUploadUrlRequest; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateUploadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.GenerateUploadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlResponse. */ + interface IGenerateUploadUrlResponse { + + /** GenerateUploadUrlResponse uploadUrl */ + uploadUrl?: (string|null); + } + + /** Represents a GenerateUploadUrlResponse. */ + class GenerateUploadUrlResponse implements IGenerateUploadUrlResponse { + + /** + * Constructs a new GenerateUploadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IGenerateUploadUrlResponse); + + /** GenerateUploadUrlResponse uploadUrl. */ + public uploadUrl: string; + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v1.IGenerateUploadUrlResponse): google.cloud.functions.v1.GenerateUploadUrlResponse; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v1.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.GenerateUploadUrlResponse; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.GenerateUploadUrlResponse; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.GenerateUploadUrlResponse; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateUploadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.GenerateUploadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlRequest. */ + interface IGenerateDownloadUrlRequest { + + /** GenerateDownloadUrlRequest name */ + name?: (string|null); + + /** GenerateDownloadUrlRequest versionId */ + versionId?: (number|Long|string|null); + } + + /** Represents a GenerateDownloadUrlRequest. */ + class GenerateDownloadUrlRequest implements IGenerateDownloadUrlRequest { + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IGenerateDownloadUrlRequest); + + /** GenerateDownloadUrlRequest name. */ + public name: string; + + /** GenerateDownloadUrlRequest versionId. */ + public versionId: (number|Long|string); + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v1.IGenerateDownloadUrlRequest): google.cloud.functions.v1.GenerateDownloadUrlRequest; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v1.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.GenerateDownloadUrlRequest; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.GenerateDownloadUrlRequest; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.GenerateDownloadUrlRequest; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.GenerateDownloadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlResponse. */ + interface IGenerateDownloadUrlResponse { + + /** GenerateDownloadUrlResponse downloadUrl */ + downloadUrl?: (string|null); + } + + /** Represents a GenerateDownloadUrlResponse. */ + class GenerateDownloadUrlResponse implements IGenerateDownloadUrlResponse { + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IGenerateDownloadUrlResponse); + + /** GenerateDownloadUrlResponse downloadUrl. */ + public downloadUrl: string; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v1.IGenerateDownloadUrlResponse): google.cloud.functions.v1.GenerateDownloadUrlResponse; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v1.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.GenerateDownloadUrlResponse; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.GenerateDownloadUrlResponse; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.GenerateDownloadUrlResponse; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.GenerateDownloadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** OperationType enum. */ + enum OperationType { + OPERATION_UNSPECIFIED = 0, + CREATE_FUNCTION = 1, + UPDATE_FUNCTION = 2, + DELETE_FUNCTION = 3 + } + + /** Properties of an OperationMetadataV1. */ + interface IOperationMetadataV1 { + + /** OperationMetadataV1 target */ + target?: (string|null); + + /** OperationMetadataV1 type */ + type?: (google.cloud.functions.v1.OperationType|keyof typeof google.cloud.functions.v1.OperationType|null); + + /** OperationMetadataV1 request */ + request?: (google.protobuf.IAny|null); + + /** OperationMetadataV1 versionId */ + versionId?: (number|Long|string|null); + + /** OperationMetadataV1 updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadataV1 buildId */ + buildId?: (string|null); + } + + /** Represents an OperationMetadataV1. */ + class OperationMetadataV1 implements IOperationMetadataV1 { + + /** + * Constructs a new OperationMetadataV1. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.IOperationMetadataV1); + + /** OperationMetadataV1 target. */ + public target: string; + + /** OperationMetadataV1 type. */ + public type: (google.cloud.functions.v1.OperationType|keyof typeof google.cloud.functions.v1.OperationType); + + /** OperationMetadataV1 request. */ + public request?: (google.protobuf.IAny|null); + + /** OperationMetadataV1 versionId. */ + public versionId: (number|Long|string); + + /** OperationMetadataV1 updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadataV1 buildId. */ + public buildId: string; + + /** + * Creates a new OperationMetadataV1 instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadataV1 instance + */ + public static create(properties?: google.cloud.functions.v1.IOperationMetadataV1): google.cloud.functions.v1.OperationMetadataV1; + + /** + * Encodes the specified OperationMetadataV1 message. Does not implicitly {@link google.cloud.functions.v1.OperationMetadataV1.verify|verify} messages. + * @param message OperationMetadataV1 message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.IOperationMetadataV1, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadataV1 message, length delimited. Does not implicitly {@link google.cloud.functions.v1.OperationMetadataV1.verify|verify} messages. + * @param message OperationMetadataV1 message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.IOperationMetadataV1, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadataV1 message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadataV1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.OperationMetadataV1; + + /** + * Decodes an OperationMetadataV1 message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadataV1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.OperationMetadataV1; + + /** + * Verifies an OperationMetadataV1 message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationMetadataV1 message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadataV1 + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.OperationMetadataV1; + + /** + * Creates a plain object from an OperationMetadataV1 message. Also converts values to other types if specified. + * @param message OperationMetadataV1 + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.OperationMetadataV1, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadataV1 to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: (google.api.IHttpRule[]|null); + + /** Http fullyDecodeReservedExpansion */ + fullyDecodeReservedExpansion?: (boolean|null); + } + + /** Represents a Http. */ + class Http implements IHttp { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** Http fullyDecodeReservedExpansion. */ + public fullyDecodeReservedExpansion: boolean; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HttpRule. */ + interface IHttpRule { + + /** HttpRule selector */ + selector?: (string|null); + + /** HttpRule get */ + get?: (string|null); + + /** HttpRule put */ + put?: (string|null); + + /** HttpRule post */ + post?: (string|null); + + /** HttpRule delete */ + "delete"?: (string|null); + + /** HttpRule patch */ + patch?: (string|null); + + /** HttpRule custom */ + custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body */ + body?: (string|null); + + /** HttpRule responseBody */ + responseBody?: (string|null); + + /** HttpRule additionalBindings */ + additionalBindings?: (google.api.IHttpRule[]|null); + } + + /** Represents a HttpRule. */ + class HttpRule implements IHttpRule { + + /** + * Constructs a new HttpRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpRule); + + /** HttpRule selector. */ + public selector: string; + + /** HttpRule get. */ + public get: string; + + /** HttpRule put. */ + public put: string; + + /** HttpRule post. */ + public post: string; + + /** HttpRule delete. */ + public delete: string; + + /** HttpRule patch. */ + public patch: string; + + /** HttpRule custom. */ + public custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body. */ + public body: string; + + /** HttpRule responseBody. */ + public responseBody: string; + + /** HttpRule additionalBindings. */ + public additionalBindings: google.api.IHttpRule[]; + + /** HttpRule pattern. */ + public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); + + /** + * Creates a new HttpRule instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpRule instance + */ + public static create(properties?: google.api.IHttpRule): google.api.HttpRule; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; + + /** + * Verifies a HttpRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpRule + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpRule; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @param message HttpRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomHttpPattern. */ + interface ICustomHttpPattern { + + /** CustomHttpPattern kind */ + kind?: (string|null); + + /** CustomHttpPattern path */ + path?: (string|null); + } + + /** Represents a CustomHttpPattern. */ + class CustomHttpPattern implements ICustomHttpPattern { + + /** + * Constructs a new CustomHttpPattern. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICustomHttpPattern); + + /** CustomHttpPattern kind. */ + public kind: string; + + /** CustomHttpPattern path. */ + public path: string; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomHttpPattern instance + */ + public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; + + /** + * Verifies a CustomHttpPattern message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomHttpPattern + */ + public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @param message CustomHttpPattern + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomHttpPattern to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace protobuf. */ + namespace protobuf { + + /** Properties of a FileDescriptorSet. */ + interface IFileDescriptorSet { + + /** FileDescriptorSet file */ + file?: (google.protobuf.IFileDescriptorProto[]|null); + } + + /** Represents a FileDescriptorSet. */ + class FileDescriptorSet implements IFileDescriptorSet { + + /** + * Constructs a new FileDescriptorSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorSet); + + /** FileDescriptorSet file. */ + public file: google.protobuf.IFileDescriptorProto[]; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorSet instance + */ + public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + + /** + * Verifies a FileDescriptorSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @param message FileDescriptorSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FileDescriptorProto. */ + interface IFileDescriptorProto { + + /** FileDescriptorProto name */ + name?: (string|null); + + /** FileDescriptorProto package */ + "package"?: (string|null); + + /** FileDescriptorProto dependency */ + dependency?: (string[]|null); + + /** FileDescriptorProto publicDependency */ + publicDependency?: (number[]|null); + + /** FileDescriptorProto weakDependency */ + weakDependency?: (number[]|null); + + /** FileDescriptorProto messageType */ + messageType?: (google.protobuf.IDescriptorProto[]|null); + + /** FileDescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** FileDescriptorProto service */ + service?: (google.protobuf.IServiceDescriptorProto[]|null); + + /** FileDescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** FileDescriptorProto options */ + options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo */ + sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax */ + syntax?: (string|null); + } + + /** Represents a FileDescriptorProto. */ + class FileDescriptorProto implements IFileDescriptorProto { + + /** + * Constructs a new FileDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorProto); + + /** FileDescriptorProto name. */ + public name: string; + + /** FileDescriptorProto package. */ + public package: string; + + /** FileDescriptorProto dependency. */ + public dependency: string[]; + + /** FileDescriptorProto publicDependency. */ + public publicDependency: number[]; + + /** FileDescriptorProto weakDependency. */ + public weakDependency: number[]; + + /** FileDescriptorProto messageType. */ + public messageType: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service. */ + public service: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options. */ + public options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo. */ + public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax. */ + public syntax: string; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + + /** + * Verifies a FileDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @param message FileDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DescriptorProto. */ + interface IDescriptorProto { + + /** DescriptorProto name */ + name?: (string|null); + + /** DescriptorProto field */ + field?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto nestedType */ + nestedType?: (google.protobuf.IDescriptorProto[]|null); + + /** DescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** DescriptorProto extensionRange */ + extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); + + /** DescriptorProto oneofDecl */ + oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); + + /** DescriptorProto options */ + options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange */ + reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); + + /** DescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents a DescriptorProto. */ + class DescriptorProto implements IDescriptorProto { + + /** + * Constructs a new DescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDescriptorProto); + + /** DescriptorProto name. */ + public name: string; + + /** DescriptorProto field. */ + public field: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType. */ + public nestedType: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange. */ + public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl. */ + public oneofDecl: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options. */ + public options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange. */ + public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns DescriptorProto instance + */ + public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + + /** + * Verifies a DescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @param message DescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DescriptorProto { + + /** Properties of an ExtensionRange. */ + interface IExtensionRange { + + /** ExtensionRange start */ + start?: (number|null); + + /** ExtensionRange end */ + end?: (number|null); + + /** ExtensionRange options */ + options?: (google.protobuf.IExtensionRangeOptions|null); + } + + /** Represents an ExtensionRange. */ + class ExtensionRange implements IExtensionRange { + + /** + * Constructs a new ExtensionRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); + + /** ExtensionRange start. */ + public start: number; + + /** ExtensionRange end. */ + public end: number; + + /** ExtensionRange options. */ + public options?: (google.protobuf.IExtensionRangeOptions|null); + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Verifies an ExtensionRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @param message ExtensionRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReservedRange. */ + interface IReservedRange { + + /** ReservedRange start */ + start?: (number|null); + + /** ReservedRange end */ + end?: (number|null); + } + + /** Represents a ReservedRange. */ + class ReservedRange implements IReservedRange { + + /** + * Constructs a new ReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); + + /** ReservedRange start. */ + public start: number; + + /** ReservedRange end. */ + public end: number; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ReservedRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Verifies a ReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @param message ReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an ExtensionRangeOptions. */ + interface IExtensionRangeOptions { + + /** ExtensionRangeOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an ExtensionRangeOptions. */ + class ExtensionRangeOptions implements IExtensionRangeOptions { + + /** + * Constructs a new ExtensionRangeOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IExtensionRangeOptions); + + /** ExtensionRangeOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRangeOptions instance + */ + public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions; + + /** + * Verifies an ExtensionRangeOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRangeOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @param message ExtensionRangeOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldDescriptorProto. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: (string|null); + + /** FieldDescriptorProto number */ + number?: (number|null); + + /** FieldDescriptorProto label */ + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + + /** FieldDescriptorProto type */ + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + + /** FieldDescriptorProto typeName */ + typeName?: (string|null); + + /** FieldDescriptorProto extendee */ + extendee?: (string|null); + + /** FieldDescriptorProto defaultValue */ + defaultValue?: (string|null); + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: (number|null); + + /** FieldDescriptorProto jsonName */ + jsonName?: (string|null); + + /** FieldDescriptorProto options */ + options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); + } + + /** Represents a FieldDescriptorProto. */ + class FieldDescriptorProto implements IFieldDescriptorProto { + + /** + * Constructs a new FieldDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldDescriptorProto); + + /** FieldDescriptorProto name. */ + public name: string; + + /** FieldDescriptorProto number. */ + public number: number; + + /** FieldDescriptorProto label. */ + public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); + + /** FieldDescriptorProto type. */ + public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); + + /** FieldDescriptorProto typeName. */ + public typeName: string; + + /** FieldDescriptorProto extendee. */ + public extendee: string; + + /** FieldDescriptorProto defaultValue. */ + public defaultValue: string; + + /** FieldDescriptorProto oneofIndex. */ + public oneofIndex: number; + + /** FieldDescriptorProto jsonName. */ + public jsonName: string; + + /** FieldDescriptorProto options. */ + public options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional. */ + public proto3Optional: boolean; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FieldDescriptorProto { + + /** Type enum. */ + enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18 + } + + /** Label enum. */ + enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3 + } + } + + /** Properties of an OneofDescriptorProto. */ + interface IOneofDescriptorProto { + + /** OneofDescriptorProto name */ + name?: (string|null); + + /** OneofDescriptorProto options */ + options?: (google.protobuf.IOneofOptions|null); + } + + /** Represents an OneofDescriptorProto. */ + class OneofDescriptorProto implements IOneofDescriptorProto { + + /** + * Constructs a new OneofDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofDescriptorProto); + + /** OneofDescriptorProto name. */ + public name: string; + + /** OneofDescriptorProto options. */ + public options?: (google.protobuf.IOneofOptions|null); + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofDescriptorProto instance + */ + public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + + /** + * Verifies an OneofDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @param message OneofDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumDescriptorProto. */ + interface IEnumDescriptorProto { + + /** EnumDescriptorProto name */ + name?: (string|null); + + /** EnumDescriptorProto value */ + value?: (google.protobuf.IEnumValueDescriptorProto[]|null); + + /** EnumDescriptorProto options */ + options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange */ + reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); + + /** EnumDescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents an EnumDescriptorProto. */ + class EnumDescriptorProto implements IEnumDescriptorProto { + + /** + * Constructs a new EnumDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumDescriptorProto); + + /** EnumDescriptorProto name. */ + public name: string; + + /** EnumDescriptorProto value. */ + public value: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options. */ + public options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange. */ + public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; + + /** EnumDescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + + /** + * Verifies an EnumDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @param message EnumDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EnumDescriptorProto { + + /** Properties of an EnumReservedRange. */ + interface IEnumReservedRange { + + /** EnumReservedRange start */ + start?: (number|null); + + /** EnumReservedRange end */ + end?: (number|null); + } + + /** Represents an EnumReservedRange. */ + class EnumReservedRange implements IEnumReservedRange { + + /** + * Constructs a new EnumReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); + + /** EnumReservedRange start. */ + public start: number; + + /** EnumReservedRange end. */ + public end: number; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumReservedRange instance + */ + public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Verifies an EnumReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @param message EnumReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EnumValueDescriptorProto. */ + interface IEnumValueDescriptorProto { + + /** EnumValueDescriptorProto name */ + name?: (string|null); + + /** EnumValueDescriptorProto number */ + number?: (number|null); + + /** EnumValueDescriptorProto options */ + options?: (google.protobuf.IEnumValueOptions|null); + } + + /** Represents an EnumValueDescriptorProto. */ + class EnumValueDescriptorProto implements IEnumValueDescriptorProto { + + /** + * Constructs a new EnumValueDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueDescriptorProto); + + /** EnumValueDescriptorProto name. */ + public name: string; + + /** EnumValueDescriptorProto number. */ + public number: number; + + /** EnumValueDescriptorProto options. */ + public options?: (google.protobuf.IEnumValueOptions|null); + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + + /** + * Verifies an EnumValueDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @param message EnumValueDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceDescriptorProto. */ + interface IServiceDescriptorProto { + + /** ServiceDescriptorProto name */ + name?: (string|null); + + /** ServiceDescriptorProto method */ + method?: (google.protobuf.IMethodDescriptorProto[]|null); + + /** ServiceDescriptorProto options */ + options?: (google.protobuf.IServiceOptions|null); + } + + /** Represents a ServiceDescriptorProto. */ + class ServiceDescriptorProto implements IServiceDescriptorProto { + + /** + * Constructs a new ServiceDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceDescriptorProto); + + /** ServiceDescriptorProto name. */ + public name: string; + + /** ServiceDescriptorProto method. */ + public method: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options. */ + public options?: (google.protobuf.IServiceOptions|null); + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceDescriptorProto instance + */ + public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + + /** + * Verifies a ServiceDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @param message ServiceDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MethodDescriptorProto. */ + interface IMethodDescriptorProto { + + /** MethodDescriptorProto name */ + name?: (string|null); + + /** MethodDescriptorProto inputType */ + inputType?: (string|null); + + /** MethodDescriptorProto outputType */ + outputType?: (string|null); + + /** MethodDescriptorProto options */ + options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming */ + clientStreaming?: (boolean|null); + + /** MethodDescriptorProto serverStreaming */ + serverStreaming?: (boolean|null); + } + + /** Represents a MethodDescriptorProto. */ + class MethodDescriptorProto implements IMethodDescriptorProto { + + /** + * Constructs a new MethodDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodDescriptorProto); + + /** MethodDescriptorProto name. */ + public name: string; + + /** MethodDescriptorProto inputType. */ + public inputType: string; + + /** MethodDescriptorProto outputType. */ + public outputType: string; + + /** MethodDescriptorProto options. */ + public options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming. */ + public clientStreaming: boolean; + + /** MethodDescriptorProto serverStreaming. */ + public serverStreaming: boolean; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodDescriptorProto instance + */ + public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + + /** + * Verifies a MethodDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @param message MethodDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FileOptions. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: (string|null); + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: (string|null); + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: (boolean|null); + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: (boolean|null); + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: (boolean|null); + + /** FileOptions optimizeFor */ + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + + /** FileOptions goPackage */ + goPackage?: (string|null); + + /** FileOptions ccGenericServices */ + ccGenericServices?: (boolean|null); + + /** FileOptions javaGenericServices */ + javaGenericServices?: (boolean|null); + + /** FileOptions pyGenericServices */ + pyGenericServices?: (boolean|null); + + /** FileOptions phpGenericServices */ + phpGenericServices?: (boolean|null); + + /** FileOptions deprecated */ + deprecated?: (boolean|null); + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: (boolean|null); + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: (string|null); + + /** FileOptions csharpNamespace */ + csharpNamespace?: (string|null); + + /** FileOptions swiftPrefix */ + swiftPrefix?: (string|null); + + /** FileOptions phpClassPrefix */ + phpClassPrefix?: (string|null); + + /** FileOptions phpNamespace */ + phpNamespace?: (string|null); + + /** FileOptions phpMetadataNamespace */ + phpMetadataNamespace?: (string|null); + + /** FileOptions rubyPackage */ + rubyPackage?: (string|null); + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); + } + + /** Represents a FileOptions. */ + class FileOptions implements IFileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions phpGenericServices. */ + public phpGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions swiftPrefix. */ + public swiftPrefix: string; + + /** FileOptions phpClassPrefix. */ + public phpClassPrefix: string; + + /** FileOptions phpNamespace. */ + public phpNamespace: string; + + /** FileOptions phpMetadataNamespace. */ + public phpMetadataNamespace: string; + + /** FileOptions rubyPackage. */ + public rubyPackage: string; + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FileOptions { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: (boolean|null); + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: (boolean|null); + + /** MessageOptions deprecated */ + deprecated?: (boolean|null); + + /** MessageOptions mapEntry */ + mapEntry?: (boolean|null); + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); + } + + /** Represents a MessageOptions. */ + class MessageOptions implements IMessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldOptions. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + + /** FieldOptions lazy */ + lazy?: (boolean|null); + + /** FieldOptions deprecated */ + deprecated?: (boolean|null); + + /** FieldOptions weak */ + weak?: (boolean|null); + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FieldOptions .google.api.fieldBehavior */ + ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); + } + + /** Represents a FieldOptions. */ + class FieldOptions implements IFieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions deprecated. */ + public deprecated: boolean; + + /** FieldOptions weak. */ + public weak: boolean; + + /** FieldOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOptions instance + */ + public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + + /** + * Verifies a FieldOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @param message FieldOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FieldOptions { + + /** CType enum. */ + enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2 + } + + /** JSType enum. */ + enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2 + } + } + + /** Properties of an OneofOptions. */ + interface IOneofOptions { + + /** OneofOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an OneofOptions. */ + class OneofOptions implements IOneofOptions { + + /** + * Constructs a new OneofOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofOptions); + + /** OneofOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofOptions instance + */ + public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + + /** + * Verifies an OneofOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @param message OneofOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumOptions. */ + interface IEnumOptions { + + /** EnumOptions allowAlias */ + allowAlias?: (boolean|null); + + /** EnumOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumOptions. */ + class EnumOptions implements IEnumOptions { + + /** + * Constructs a new EnumOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumOptions); + + /** EnumOptions allowAlias. */ + public allowAlias: boolean; + + /** EnumOptions deprecated. */ + public deprecated: boolean; + + /** EnumOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumOptions instance + */ + public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + + /** + * Verifies an EnumOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @param message EnumOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumValueOptions. */ + interface IEnumValueOptions { + + /** EnumValueOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumValueOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumValueOptions. */ + class EnumValueOptions implements IEnumValueOptions { + + /** + * Constructs a new EnumValueOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueOptions); + + /** EnumValueOptions deprecated. */ + public deprecated: boolean; + + /** EnumValueOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueOptions instance + */ + public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + + /** + * Verifies an EnumValueOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @param message EnumValueOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceOptions. */ + interface IServiceOptions { + + /** ServiceOptions deprecated */ + deprecated?: (boolean|null); + + /** ServiceOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ServiceOptions .google.api.defaultHost */ + ".google.api.defaultHost"?: (string|null); + + /** ServiceOptions .google.api.oauthScopes */ + ".google.api.oauthScopes"?: (string|null); + } + + /** Represents a ServiceOptions. */ + class ServiceOptions implements IServiceOptions { + + /** + * Constructs a new ServiceOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceOptions); + + /** ServiceOptions deprecated. */ + public deprecated: boolean; + + /** ServiceOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceOptions instance + */ + public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + + /** + * Verifies a ServiceOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @param message ServiceOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MethodOptions. */ + interface IMethodOptions { + + /** MethodOptions deprecated */ + deprecated?: (boolean|null); + + /** MethodOptions idempotencyLevel */ + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + + /** MethodOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MethodOptions .google.api.http */ + ".google.api.http"?: (google.api.IHttpRule|null); + + /** MethodOptions .google.api.methodSignature */ + ".google.api.methodSignature"?: (string[]|null); + + /** MethodOptions .google.longrunning.operationInfo */ + ".google.longrunning.operationInfo"?: (google.longrunning.IOperationInfo|null); + } + + /** Represents a MethodOptions. */ + class MethodOptions implements IMethodOptions { + + /** + * Constructs a new MethodOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodOptions); + + /** MethodOptions deprecated. */ + public deprecated: boolean; + + /** MethodOptions idempotencyLevel. */ + public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); + + /** MethodOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodOptions instance + */ + public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + + /** + * Verifies a MethodOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @param message MethodOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace MethodOptions { + + /** IdempotencyLevel enum. */ + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2 + } + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + + /** UninterpretedOption identifierValue */ + identifierValue?: (string|null); + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long|string|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|string|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|string|null); + + /** UninterpretedOption aggregateValue */ + aggregateValue?: (string|null); + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption implements IUninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long|string); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long|string); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: (Uint8Array|string); + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace UninterpretedOption { + + /** Properties of a NamePart. */ + interface INamePart { + + /** NamePart namePart */ + namePart: string; + + /** NamePart isExtension */ + isExtension: boolean; + } + + /** Represents a NamePart. */ + class NamePart implements INamePart { + + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + + /** NamePart namePart. */ + public namePart: string; + + /** NamePart isExtension. */ + public isExtension: boolean; + + /** + * Creates a new NamePart instance using the specified properties. + * @param [properties] Properties to set + * @returns NamePart instance + */ + public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + + /** + * Verifies a NamePart message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NamePart + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @param message NamePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NamePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo implements ISourceCodeInfo { + + /** + * Constructs a new SourceCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ISourceCodeInfo); + + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceCodeInfo instance + */ + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + + /** + * Verifies a SourceCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @param message SourceCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SourceCodeInfo { + + /** Properties of a Location. */ + interface ILocation { + + /** Location path */ + path?: (number[]|null); + + /** Location span */ + span?: (number[]|null); + + /** Location leadingComments */ + leadingComments?: (string|null); + + /** Location trailingComments */ + trailingComments?: (string|null); + + /** Location leadingDetachedComments */ + leadingDetachedComments?: (string[]|null); + } + + /** Represents a Location. */ + class Location implements ILocation { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + + /** Location path. */ + public path: number[]; + + /** Location span. */ + public span: number[]; + + /** Location leadingComments. */ + public leadingComments: string; + + /** Location trailingComments. */ + public trailingComments: string; + + /** Location leadingDetachedComments. */ + public leadingDetachedComments: string[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { + + /** GeneratedCodeInfo annotation */ + annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); + } + + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo implements IGeneratedCodeInfo { + + /** + * Constructs a new GeneratedCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IGeneratedCodeInfo); + + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratedCodeInfo instance + */ + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + + /** + * Verifies a GeneratedCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratedCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @param message GeneratedCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace GeneratedCodeInfo { + + /** Properties of an Annotation. */ + interface IAnnotation { + + /** Annotation path */ + path?: (number[]|null); + + /** Annotation sourceFile */ + sourceFile?: (string|null); + + /** Annotation begin */ + begin?: (number|null); + + /** Annotation end */ + end?: (number|null); + } + + /** Represents an Annotation. */ + class Annotation implements IAnnotation { + + /** + * Constructs a new Annotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + + /** Annotation path. */ + public path: number[]; + + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; + + /** + * Creates a new Annotation instance using the specified properties. + * @param [properties] Properties to set + * @returns Annotation instance + */ + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Verifies an Annotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Annotation + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @param message Annotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Annotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; + + /** + * Verifies an Any message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } + + /** Represents a Duration. */ + class Duration implements IDuration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace iam. */ + namespace iam { + + /** Namespace v1. */ + namespace v1 { + + /** Represents a IAMPolicy */ + class IAMPolicy extends $protobuf.rpc.Service { + + /** + * Constructs a new IAMPolicy service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new IAMPolicy service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): IAMPolicy; + + /** + * Calls SetIamPolicy. + * @param request SetIamPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Policy + */ + public setIamPolicy(request: google.iam.v1.ISetIamPolicyRequest, callback: google.iam.v1.IAMPolicy.SetIamPolicyCallback): void; + + /** + * Calls SetIamPolicy. + * @param request SetIamPolicyRequest message or plain object + * @returns Promise + */ + public setIamPolicy(request: google.iam.v1.ISetIamPolicyRequest): Promise; + + /** + * Calls GetIamPolicy. + * @param request GetIamPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Policy + */ + public getIamPolicy(request: google.iam.v1.IGetIamPolicyRequest, callback: google.iam.v1.IAMPolicy.GetIamPolicyCallback): void; + + /** + * Calls GetIamPolicy. + * @param request GetIamPolicyRequest message or plain object + * @returns Promise + */ + public getIamPolicy(request: google.iam.v1.IGetIamPolicyRequest): Promise; + + /** + * Calls TestIamPermissions. + * @param request TestIamPermissionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TestIamPermissionsResponse + */ + public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest, callback: google.iam.v1.IAMPolicy.TestIamPermissionsCallback): void; + + /** + * Calls TestIamPermissions. + * @param request TestIamPermissionsRequest message or plain object + * @returns Promise + */ + public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest): Promise; + } + + namespace IAMPolicy { + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * @param error Error, if any + * @param [response] Policy + */ + type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * @param error Error, if any + * @param [response] Policy + */ + type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * @param error Error, if any + * @param [response] TestIamPermissionsResponse + */ + type TestIamPermissionsCallback = (error: (Error|null), response?: google.iam.v1.TestIamPermissionsResponse) => void; + } + + /** Properties of a SetIamPolicyRequest. */ + interface ISetIamPolicyRequest { + + /** SetIamPolicyRequest resource */ + resource?: (string|null); + + /** SetIamPolicyRequest policy */ + policy?: (google.iam.v1.IPolicy|null); + } + + /** Represents a SetIamPolicyRequest. */ + class SetIamPolicyRequest implements ISetIamPolicyRequest { + + /** + * Constructs a new SetIamPolicyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.ISetIamPolicyRequest); + + /** SetIamPolicyRequest resource. */ + public resource: string; + + /** SetIamPolicyRequest policy. */ + public policy?: (google.iam.v1.IPolicy|null); + + /** + * Creates a new SetIamPolicyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetIamPolicyRequest instance + */ + public static create(properties?: google.iam.v1.ISetIamPolicyRequest): google.iam.v1.SetIamPolicyRequest; + + /** + * Encodes the specified SetIamPolicyRequest message. Does not implicitly {@link google.iam.v1.SetIamPolicyRequest.verify|verify} messages. + * @param message SetIamPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.ISetIamPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetIamPolicyRequest message, length delimited. Does not implicitly {@link google.iam.v1.SetIamPolicyRequest.verify|verify} messages. + * @param message SetIamPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.ISetIamPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetIamPolicyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.SetIamPolicyRequest; + + /** + * Decodes a SetIamPolicyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.SetIamPolicyRequest; + + /** + * Verifies a SetIamPolicyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetIamPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetIamPolicyRequest + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.SetIamPolicyRequest; + + /** + * Creates a plain object from a SetIamPolicyRequest message. Also converts values to other types if specified. + * @param message SetIamPolicyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.SetIamPolicyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetIamPolicyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetIamPolicyRequest. */ + interface IGetIamPolicyRequest { + + /** GetIamPolicyRequest resource */ + resource?: (string|null); + + /** GetIamPolicyRequest options */ + options?: (google.iam.v1.IGetPolicyOptions|null); + } + + /** Represents a GetIamPolicyRequest. */ + class GetIamPolicyRequest implements IGetIamPolicyRequest { + + /** + * Constructs a new GetIamPolicyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IGetIamPolicyRequest); + + /** GetIamPolicyRequest resource. */ + public resource: string; + + /** GetIamPolicyRequest options. */ + public options?: (google.iam.v1.IGetPolicyOptions|null); + + /** + * Creates a new GetIamPolicyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetIamPolicyRequest instance + */ + public static create(properties?: google.iam.v1.IGetIamPolicyRequest): google.iam.v1.GetIamPolicyRequest; + + /** + * Encodes the specified GetIamPolicyRequest message. Does not implicitly {@link google.iam.v1.GetIamPolicyRequest.verify|verify} messages. + * @param message GetIamPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IGetIamPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetIamPolicyRequest message, length delimited. Does not implicitly {@link google.iam.v1.GetIamPolicyRequest.verify|verify} messages. + * @param message GetIamPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IGetIamPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetIamPolicyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.GetIamPolicyRequest; + + /** + * Decodes a GetIamPolicyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.GetIamPolicyRequest; + + /** + * Verifies a GetIamPolicyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetIamPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetIamPolicyRequest + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.GetIamPolicyRequest; + + /** + * Creates a plain object from a GetIamPolicyRequest message. Also converts values to other types if specified. + * @param message GetIamPolicyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.GetIamPolicyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetIamPolicyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TestIamPermissionsRequest. */ + interface ITestIamPermissionsRequest { + + /** TestIamPermissionsRequest resource */ + resource?: (string|null); + + /** TestIamPermissionsRequest permissions */ + permissions?: (string[]|null); + } + + /** Represents a TestIamPermissionsRequest. */ + class TestIamPermissionsRequest implements ITestIamPermissionsRequest { + + /** + * Constructs a new TestIamPermissionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.ITestIamPermissionsRequest); + + /** TestIamPermissionsRequest resource. */ + public resource: string; + + /** TestIamPermissionsRequest permissions. */ + public permissions: string[]; + + /** + * Creates a new TestIamPermissionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TestIamPermissionsRequest instance + */ + public static create(properties?: google.iam.v1.ITestIamPermissionsRequest): google.iam.v1.TestIamPermissionsRequest; + + /** + * Encodes the specified TestIamPermissionsRequest message. Does not implicitly {@link google.iam.v1.TestIamPermissionsRequest.verify|verify} messages. + * @param message TestIamPermissionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.ITestIamPermissionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TestIamPermissionsRequest message, length delimited. Does not implicitly {@link google.iam.v1.TestIamPermissionsRequest.verify|verify} messages. + * @param message TestIamPermissionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.ITestIamPermissionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TestIamPermissionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TestIamPermissionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.TestIamPermissionsRequest; + + /** + * Decodes a TestIamPermissionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TestIamPermissionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.TestIamPermissionsRequest; + + /** + * Verifies a TestIamPermissionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TestIamPermissionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TestIamPermissionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.TestIamPermissionsRequest; + + /** + * Creates a plain object from a TestIamPermissionsRequest message. Also converts values to other types if specified. + * @param message TestIamPermissionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.TestIamPermissionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TestIamPermissionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TestIamPermissionsResponse. */ + interface ITestIamPermissionsResponse { + + /** TestIamPermissionsResponse permissions */ + permissions?: (string[]|null); + } + + /** Represents a TestIamPermissionsResponse. */ + class TestIamPermissionsResponse implements ITestIamPermissionsResponse { + + /** + * Constructs a new TestIamPermissionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.ITestIamPermissionsResponse); + + /** TestIamPermissionsResponse permissions. */ + public permissions: string[]; + + /** + * Creates a new TestIamPermissionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TestIamPermissionsResponse instance + */ + public static create(properties?: google.iam.v1.ITestIamPermissionsResponse): google.iam.v1.TestIamPermissionsResponse; + + /** + * Encodes the specified TestIamPermissionsResponse message. Does not implicitly {@link google.iam.v1.TestIamPermissionsResponse.verify|verify} messages. + * @param message TestIamPermissionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.ITestIamPermissionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TestIamPermissionsResponse message, length delimited. Does not implicitly {@link google.iam.v1.TestIamPermissionsResponse.verify|verify} messages. + * @param message TestIamPermissionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.ITestIamPermissionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TestIamPermissionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TestIamPermissionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.TestIamPermissionsResponse; + + /** + * Decodes a TestIamPermissionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TestIamPermissionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.TestIamPermissionsResponse; + + /** + * Verifies a TestIamPermissionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TestIamPermissionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TestIamPermissionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.TestIamPermissionsResponse; + + /** + * Creates a plain object from a TestIamPermissionsResponse message. Also converts values to other types if specified. + * @param message TestIamPermissionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.TestIamPermissionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TestIamPermissionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetPolicyOptions. */ + interface IGetPolicyOptions { + + /** GetPolicyOptions requestedPolicyVersion */ + requestedPolicyVersion?: (number|null); + } + + /** Represents a GetPolicyOptions. */ + class GetPolicyOptions implements IGetPolicyOptions { + + /** + * Constructs a new GetPolicyOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IGetPolicyOptions); + + /** GetPolicyOptions requestedPolicyVersion. */ + public requestedPolicyVersion: number; + + /** + * Creates a new GetPolicyOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns GetPolicyOptions instance + */ + public static create(properties?: google.iam.v1.IGetPolicyOptions): google.iam.v1.GetPolicyOptions; + + /** + * Encodes the specified GetPolicyOptions message. Does not implicitly {@link google.iam.v1.GetPolicyOptions.verify|verify} messages. + * @param message GetPolicyOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IGetPolicyOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetPolicyOptions message, length delimited. Does not implicitly {@link google.iam.v1.GetPolicyOptions.verify|verify} messages. + * @param message GetPolicyOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IGetPolicyOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetPolicyOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetPolicyOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.GetPolicyOptions; + + /** + * Decodes a GetPolicyOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetPolicyOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.GetPolicyOptions; + + /** + * Verifies a GetPolicyOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetPolicyOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetPolicyOptions + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.GetPolicyOptions; + + /** + * Creates a plain object from a GetPolicyOptions message. Also converts values to other types if specified. + * @param message GetPolicyOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.GetPolicyOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetPolicyOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Policy. */ + interface IPolicy { + + /** Policy version */ + version?: (number|null); + + /** Policy bindings */ + bindings?: (google.iam.v1.IBinding[]|null); + + /** Policy etag */ + etag?: (Uint8Array|string|null); + } + + /** Represents a Policy. */ + class Policy implements IPolicy { + + /** + * Constructs a new Policy. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IPolicy); + + /** Policy version. */ + public version: number; + + /** Policy bindings. */ + public bindings: google.iam.v1.IBinding[]; + + /** Policy etag. */ + public etag: (Uint8Array|string); + + /** + * Creates a new Policy instance using the specified properties. + * @param [properties] Properties to set + * @returns Policy instance + */ + public static create(properties?: google.iam.v1.IPolicy): google.iam.v1.Policy; + + /** + * Encodes the specified Policy message. Does not implicitly {@link google.iam.v1.Policy.verify|verify} messages. + * @param message Policy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Policy message, length delimited. Does not implicitly {@link google.iam.v1.Policy.verify|verify} messages. + * @param message Policy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Policy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Policy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.Policy; + + /** + * Decodes a Policy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Policy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.Policy; + + /** + * Verifies a Policy message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Policy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Policy + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.Policy; + + /** + * Creates a plain object from a Policy message. Also converts values to other types if specified. + * @param message Policy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.Policy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Policy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Binding. */ + interface IBinding { + + /** Binding role */ + role?: (string|null); + + /** Binding members */ + members?: (string[]|null); + + /** Binding condition */ + condition?: (google.type.IExpr|null); + } + + /** Represents a Binding. */ + class Binding implements IBinding { + + /** + * Constructs a new Binding. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IBinding); + + /** Binding role. */ + public role: string; + + /** Binding members. */ + public members: string[]; + + /** Binding condition. */ + public condition?: (google.type.IExpr|null); + + /** + * Creates a new Binding instance using the specified properties. + * @param [properties] Properties to set + * @returns Binding instance + */ + public static create(properties?: google.iam.v1.IBinding): google.iam.v1.Binding; + + /** + * Encodes the specified Binding message. Does not implicitly {@link google.iam.v1.Binding.verify|verify} messages. + * @param message Binding message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IBinding, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Binding message, length delimited. Does not implicitly {@link google.iam.v1.Binding.verify|verify} messages. + * @param message Binding message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IBinding, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Binding message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Binding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.Binding; + + /** + * Decodes a Binding message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Binding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.Binding; + + /** + * Verifies a Binding message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Binding message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Binding + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.Binding; + + /** + * Creates a plain object from a Binding message. Also converts values to other types if specified. + * @param message Binding + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.Binding, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Binding to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PolicyDelta. */ + interface IPolicyDelta { + + /** PolicyDelta bindingDeltas */ + bindingDeltas?: (google.iam.v1.IBindingDelta[]|null); + + /** PolicyDelta auditConfigDeltas */ + auditConfigDeltas?: (google.iam.v1.IAuditConfigDelta[]|null); + } + + /** Represents a PolicyDelta. */ + class PolicyDelta implements IPolicyDelta { + + /** + * Constructs a new PolicyDelta. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IPolicyDelta); + + /** PolicyDelta bindingDeltas. */ + public bindingDeltas: google.iam.v1.IBindingDelta[]; + + /** PolicyDelta auditConfigDeltas. */ + public auditConfigDeltas: google.iam.v1.IAuditConfigDelta[]; + + /** + * Creates a new PolicyDelta instance using the specified properties. + * @param [properties] Properties to set + * @returns PolicyDelta instance + */ + public static create(properties?: google.iam.v1.IPolicyDelta): google.iam.v1.PolicyDelta; + + /** + * Encodes the specified PolicyDelta message. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * @param message PolicyDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IPolicyDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PolicyDelta message, length delimited. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * @param message PolicyDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IPolicyDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PolicyDelta message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PolicyDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.PolicyDelta; + + /** + * Decodes a PolicyDelta message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PolicyDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.PolicyDelta; + + /** + * Verifies a PolicyDelta message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PolicyDelta message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PolicyDelta + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.PolicyDelta; + + /** + * Creates a plain object from a PolicyDelta message. Also converts values to other types if specified. + * @param message PolicyDelta + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.PolicyDelta, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PolicyDelta to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BindingDelta. */ + interface IBindingDelta { + + /** BindingDelta action */ + action?: (google.iam.v1.BindingDelta.Action|keyof typeof google.iam.v1.BindingDelta.Action|null); + + /** BindingDelta role */ + role?: (string|null); + + /** BindingDelta member */ + member?: (string|null); + + /** BindingDelta condition */ + condition?: (google.type.IExpr|null); + } + + /** Represents a BindingDelta. */ + class BindingDelta implements IBindingDelta { + + /** + * Constructs a new BindingDelta. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IBindingDelta); + + /** BindingDelta action. */ + public action: (google.iam.v1.BindingDelta.Action|keyof typeof google.iam.v1.BindingDelta.Action); + + /** BindingDelta role. */ + public role: string; + + /** BindingDelta member. */ + public member: string; + + /** BindingDelta condition. */ + public condition?: (google.type.IExpr|null); + + /** + * Creates a new BindingDelta instance using the specified properties. + * @param [properties] Properties to set + * @returns BindingDelta instance + */ + public static create(properties?: google.iam.v1.IBindingDelta): google.iam.v1.BindingDelta; + + /** + * Encodes the specified BindingDelta message. Does not implicitly {@link google.iam.v1.BindingDelta.verify|verify} messages. + * @param message BindingDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IBindingDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BindingDelta message, length delimited. Does not implicitly {@link google.iam.v1.BindingDelta.verify|verify} messages. + * @param message BindingDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IBindingDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BindingDelta message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BindingDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.BindingDelta; + + /** + * Decodes a BindingDelta message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BindingDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.BindingDelta; + + /** + * Verifies a BindingDelta message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BindingDelta message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BindingDelta + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.BindingDelta; + + /** + * Creates a plain object from a BindingDelta message. Also converts values to other types if specified. + * @param message BindingDelta + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.BindingDelta, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BindingDelta to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BindingDelta { + + /** Action enum. */ + enum Action { + ACTION_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2 + } + } + + /** Properties of an AuditConfigDelta. */ + interface IAuditConfigDelta { + + /** AuditConfigDelta action */ + action?: (google.iam.v1.AuditConfigDelta.Action|keyof typeof google.iam.v1.AuditConfigDelta.Action|null); + + /** AuditConfigDelta service */ + service?: (string|null); + + /** AuditConfigDelta exemptedMember */ + exemptedMember?: (string|null); + + /** AuditConfigDelta logType */ + logType?: (string|null); + } + + /** Represents an AuditConfigDelta. */ + class AuditConfigDelta implements IAuditConfigDelta { + + /** + * Constructs a new AuditConfigDelta. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IAuditConfigDelta); + + /** AuditConfigDelta action. */ + public action: (google.iam.v1.AuditConfigDelta.Action|keyof typeof google.iam.v1.AuditConfigDelta.Action); + + /** AuditConfigDelta service. */ + public service: string; + + /** AuditConfigDelta exemptedMember. */ + public exemptedMember: string; + + /** AuditConfigDelta logType. */ + public logType: string; + + /** + * Creates a new AuditConfigDelta instance using the specified properties. + * @param [properties] Properties to set + * @returns AuditConfigDelta instance + */ + public static create(properties?: google.iam.v1.IAuditConfigDelta): google.iam.v1.AuditConfigDelta; + + /** + * Encodes the specified AuditConfigDelta message. Does not implicitly {@link google.iam.v1.AuditConfigDelta.verify|verify} messages. + * @param message AuditConfigDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IAuditConfigDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AuditConfigDelta message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfigDelta.verify|verify} messages. + * @param message AuditConfigDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IAuditConfigDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AuditConfigDelta message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AuditConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.AuditConfigDelta; + + /** + * Decodes an AuditConfigDelta message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AuditConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.AuditConfigDelta; + + /** + * Verifies an AuditConfigDelta message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AuditConfigDelta message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AuditConfigDelta + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.AuditConfigDelta; + + /** + * Creates a plain object from an AuditConfigDelta message. Also converts values to other types if specified. + * @param message AuditConfigDelta + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.AuditConfigDelta, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AuditConfigDelta to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace AuditConfigDelta { + + /** Action enum. */ + enum Action { + ACTION_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2 + } + } + } + } + + /** Namespace type. */ + namespace type { + + /** Properties of an Expr. */ + interface IExpr { + + /** Expr expression */ + expression?: (string|null); + + /** Expr title */ + title?: (string|null); + + /** Expr description */ + description?: (string|null); + + /** Expr location */ + location?: (string|null); + } + + /** Represents an Expr. */ + class Expr implements IExpr { + + /** + * Constructs a new Expr. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IExpr); + + /** Expr expression. */ + public expression: string; + + /** Expr title. */ + public title: string; + + /** Expr description. */ + public description: string; + + /** Expr location. */ + public location: string; + + /** + * Creates a new Expr instance using the specified properties. + * @param [properties] Properties to set + * @returns Expr instance + */ + public static create(properties?: google.type.IExpr): google.type.Expr; + + /** + * Encodes the specified Expr message. Does not implicitly {@link google.type.Expr.verify|verify} messages. + * @param message Expr message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.type.IExpr, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Expr message, length delimited. Does not implicitly {@link google.type.Expr.verify|verify} messages. + * @param message Expr message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.type.IExpr, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Expr message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Expr + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.Expr; + + /** + * Decodes an Expr message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Expr + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.Expr; + + /** + * Verifies an Expr message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Expr message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Expr + */ + public static fromObject(object: { [k: string]: any }): google.type.Expr; + + /** + * Creates a plain object from an Expr message. Also converts values to other types if specified. + * @param message Expr + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.type.Expr, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Expr to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace longrunning. */ + namespace longrunning { + + /** Represents an Operations */ + class Operations extends $protobuf.rpc.Service { + + /** + * Constructs a new Operations service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Operations service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Operations; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListOperationsResponse + */ + public listOperations(request: google.longrunning.IListOperationsRequest, callback: google.longrunning.Operations.ListOperationsCallback): void; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @returns Promise + */ + public listOperations(request: google.longrunning.IListOperationsRequest): Promise; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public getOperation(request: google.longrunning.IGetOperationRequest, callback: google.longrunning.Operations.GetOperationCallback): void; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @returns Promise + */ + public getOperation(request: google.longrunning.IGetOperationRequest): Promise; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest, callback: google.longrunning.Operations.DeleteOperationCallback): void; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @returns Promise + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest): Promise; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest, callback: google.longrunning.Operations.CancelOperationCallback): void; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @returns Promise + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest): Promise; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest, callback: google.longrunning.Operations.WaitOperationCallback): void; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @returns Promise + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest): Promise; + } + + namespace Operations { + + /** + * Callback as used by {@link google.longrunning.Operations#listOperations}. + * @param error Error, if any + * @param [response] ListOperationsResponse + */ + type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; + + /** + * Callback as used by {@link google.longrunning.Operations#getOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type WaitOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an Operation. */ + interface IOperation { + + /** Operation name */ + name?: (string|null); + + /** Operation metadata */ + metadata?: (google.protobuf.IAny|null); + + /** Operation done */ + done?: (boolean|null); + + /** Operation error */ + error?: (google.rpc.IStatus|null); + + /** Operation response */ + response?: (google.protobuf.IAny|null); + } + + /** Represents an Operation. */ + class Operation implements IOperation { + + /** + * Constructs a new Operation. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperation); + + /** Operation name. */ + public name: string; + + /** Operation metadata. */ + public metadata?: (google.protobuf.IAny|null); + + /** Operation done. */ + public done: boolean; + + /** Operation error. */ + public error?: (google.rpc.IStatus|null); + + /** Operation response. */ + public response?: (google.protobuf.IAny|null); + + /** Operation result. */ + public result?: ("error"|"response"); + + /** + * Creates a new Operation instance using the specified properties. + * @param [properties] Properties to set + * @returns Operation instance + */ + public static create(properties?: google.longrunning.IOperation): google.longrunning.Operation; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.Operation; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.Operation; + + /** + * Verifies an Operation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Operation + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.Operation; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @param message Operation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Operation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetOperationRequest. */ + interface IGetOperationRequest { + + /** GetOperationRequest name */ + name?: (string|null); + } + + /** Represents a GetOperationRequest. */ + class GetOperationRequest implements IGetOperationRequest { + + /** + * Constructs a new GetOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IGetOperationRequest); + + /** GetOperationRequest name. */ + public name: string; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetOperationRequest instance + */ + public static create(properties?: google.longrunning.IGetOperationRequest): google.longrunning.GetOperationRequest; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.GetOperationRequest; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.GetOperationRequest; + + /** + * Verifies a GetOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.GetOperationRequest; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @param message GetOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.GetOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListOperationsRequest. */ + interface IListOperationsRequest { + + /** ListOperationsRequest name */ + name?: (string|null); + + /** ListOperationsRequest filter */ + filter?: (string|null); + + /** ListOperationsRequest pageSize */ + pageSize?: (number|null); + + /** ListOperationsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListOperationsRequest. */ + class ListOperationsRequest implements IListOperationsRequest { + + /** + * Constructs a new ListOperationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IListOperationsRequest); + + /** ListOperationsRequest name. */ + public name: string; + + /** ListOperationsRequest filter. */ + public filter: string; + + /** ListOperationsRequest pageSize. */ + public pageSize: number; + + /** ListOperationsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListOperationsRequest instance + */ + public static create(properties?: google.longrunning.IListOperationsRequest): google.longrunning.ListOperationsRequest; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @param message ListOperationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @param message ListOperationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.ListOperationsRequest; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.ListOperationsRequest; + + /** + * Verifies a ListOperationsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListOperationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsRequest; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @param message ListOperationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.ListOperationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListOperationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListOperationsResponse. */ + interface IListOperationsResponse { + + /** ListOperationsResponse operations */ + operations?: (google.longrunning.IOperation[]|null); + + /** ListOperationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListOperationsResponse. */ + class ListOperationsResponse implements IListOperationsResponse { + + /** + * Constructs a new ListOperationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IListOperationsResponse); + + /** ListOperationsResponse operations. */ + public operations: google.longrunning.IOperation[]; + + /** ListOperationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListOperationsResponse instance + */ + public static create(properties?: google.longrunning.IListOperationsResponse): google.longrunning.ListOperationsResponse; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @param message ListOperationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @param message ListOperationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.ListOperationsResponse; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.ListOperationsResponse; + + /** + * Verifies a ListOperationsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListOperationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsResponse; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @param message ListOperationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.ListOperationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListOperationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CancelOperationRequest. */ + interface ICancelOperationRequest { + + /** CancelOperationRequest name */ + name?: (string|null); + } + + /** Represents a CancelOperationRequest. */ + class CancelOperationRequest implements ICancelOperationRequest { + + /** + * Constructs a new CancelOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.ICancelOperationRequest); + + /** CancelOperationRequest name. */ + public name: string; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CancelOperationRequest instance + */ + public static create(properties?: google.longrunning.ICancelOperationRequest): google.longrunning.CancelOperationRequest; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @param message CancelOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @param message CancelOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.CancelOperationRequest; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.CancelOperationRequest; + + /** + * Verifies a CancelOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CancelOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.CancelOperationRequest; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @param message CancelOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.CancelOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CancelOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteOperationRequest. */ + interface IDeleteOperationRequest { + + /** DeleteOperationRequest name */ + name?: (string|null); + } + + /** Represents a DeleteOperationRequest. */ + class DeleteOperationRequest implements IDeleteOperationRequest { + + /** + * Constructs a new DeleteOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IDeleteOperationRequest); + + /** DeleteOperationRequest name. */ + public name: string; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteOperationRequest instance + */ + public static create(properties?: google.longrunning.IDeleteOperationRequest): google.longrunning.DeleteOperationRequest; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @param message DeleteOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @param message DeleteOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.DeleteOperationRequest; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.DeleteOperationRequest; + + /** + * Verifies a DeleteOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.DeleteOperationRequest; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @param message DeleteOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.DeleteOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a WaitOperationRequest. */ + interface IWaitOperationRequest { + + /** WaitOperationRequest name */ + name?: (string|null); + + /** WaitOperationRequest timeout */ + timeout?: (google.protobuf.IDuration|null); + } + + /** Represents a WaitOperationRequest. */ + class WaitOperationRequest implements IWaitOperationRequest { + + /** + * Constructs a new WaitOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IWaitOperationRequest); + + /** WaitOperationRequest name. */ + public name: string; + + /** WaitOperationRequest timeout. */ + public timeout?: (google.protobuf.IDuration|null); + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WaitOperationRequest instance + */ + public static create(properties?: google.longrunning.IWaitOperationRequest): google.longrunning.WaitOperationRequest; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @param message WaitOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @param message WaitOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.WaitOperationRequest; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.WaitOperationRequest; + + /** + * Verifies a WaitOperationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WaitOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.WaitOperationRequest; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @param message WaitOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.WaitOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WaitOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OperationInfo. */ + interface IOperationInfo { + + /** OperationInfo responseType */ + responseType?: (string|null); + + /** OperationInfo metadataType */ + metadataType?: (string|null); + } + + /** Represents an OperationInfo. */ + class OperationInfo implements IOperationInfo { + + /** + * Constructs a new OperationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperationInfo); + + /** OperationInfo responseType. */ + public responseType: string; + + /** OperationInfo metadataType. */ + public metadataType: string; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationInfo instance + */ + public static create(properties?: google.longrunning.IOperationInfo): google.longrunning.OperationInfo; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @param message OperationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @param message OperationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.longrunning.OperationInfo; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.longrunning.OperationInfo; + + /** + * Verifies an OperationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationInfo + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.OperationInfo; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @param message OperationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.OperationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace rpc. */ + namespace rpc { + + /** Properties of a Status. */ + interface IStatus { + + /** Status code */ + code?: (number|null); + + /** Status message */ + message?: (string|null); + + /** Status details */ + details?: (google.protobuf.IAny[]|null); + } + + /** Represents a Status. */ + class Status implements IStatus { + + /** + * Constructs a new Status. + * @param [properties] Properties to set + */ + constructor(properties?: google.rpc.IStatus); + + /** Status code. */ + public code: number; + + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; + + /** + * Creates a new Status instance using the specified properties. + * @param [properties] Properties to set + * @returns Status instance + */ + public static create(properties?: google.rpc.IStatus): google.rpc.Status; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Status message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; + + /** + * Verifies a Status message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Status + */ + public static fromObject(object: { [k: string]: any }): google.rpc.Status; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Status to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } +} diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js new file mode 100644 index 00000000000..db678e84863 --- /dev/null +++ b/packages/google-cloud-functions/protos/protos.js @@ -0,0 +1,21703 @@ +// 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. + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +(function(global, factory) { /* global define, require, module */ + + /* AMD */ if (typeof define === 'function' && define.amd) + define(["protobufjs/minimal"], factory); + + /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) + module.exports = factory(require("protobufjs/minimal")); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots._google_cloud_functions_protos || ($protobuf.roots._google_cloud_functions_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.functions = (function() { + + /** + * Namespace functions. + * @memberof google.cloud + * @namespace + */ + var functions = {}; + + functions.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.functions + * @namespace + */ + var v1 = {}; + + v1.CloudFunctionsService = (function() { + + /** + * Constructs a new CloudFunctionsService service. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a CloudFunctionsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CloudFunctionsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CloudFunctionsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CloudFunctionsService; + + /** + * Creates new CloudFunctionsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CloudFunctionsService} RPC service. Useful where requests and/or responses are streamed. + */ + CloudFunctionsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#listFunctions}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef ListFunctionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v1.ListFunctionsResponse} [response] ListFunctionsResponse + */ + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.ListFunctionsCallback} callback Node-style callback called with the error, if any, and ListFunctionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.listFunctions = function listFunctions(request, callback) { + return this.rpcCall(listFunctions, $root.google.cloud.functions.v1.ListFunctionsRequest, $root.google.cloud.functions.v1.ListFunctionsResponse, request, callback); + }, "name", { value: "ListFunctions" }); + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#getFunction}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef GetFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v1.CloudFunction} [response] CloudFunction + */ + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.GetFunctionCallback} callback Node-style callback called with the error, if any, and CloudFunction + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.getFunction = function getFunction(request, callback) { + return this.rpcCall(getFunction, $root.google.cloud.functions.v1.GetFunctionRequest, $root.google.cloud.functions.v1.CloudFunction, request, callback); + }, "name", { value: "GetFunction" }); + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#createFunction}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef CreateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.CreateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.createFunction = function createFunction(request, callback) { + return this.rpcCall(createFunction, $root.google.cloud.functions.v1.CreateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateFunction" }); + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#updateFunction}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef UpdateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.UpdateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.updateFunction = function updateFunction(request, callback) { + return this.rpcCall(updateFunction, $root.google.cloud.functions.v1.UpdateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateFunction" }); + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#deleteFunction}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef DeleteFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.DeleteFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.deleteFunction = function deleteFunction(request, callback) { + return this.rpcCall(deleteFunction, $root.google.cloud.functions.v1.DeleteFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteFunction" }); + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#callFunction}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef CallFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v1.CallFunctionResponse} [response] CallFunctionResponse + */ + + /** + * Calls CallFunction. + * @function callFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.ICallFunctionRequest} request CallFunctionRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.CallFunctionCallback} callback Node-style callback called with the error, if any, and CallFunctionResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.callFunction = function callFunction(request, callback) { + return this.rpcCall(callFunction, $root.google.cloud.functions.v1.CallFunctionRequest, $root.google.cloud.functions.v1.CallFunctionResponse, request, callback); + }, "name", { value: "CallFunction" }); + + /** + * Calls CallFunction. + * @function callFunction + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.ICallFunctionRequest} request CallFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#generateUploadUrl}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef GenerateUploadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v1.GenerateUploadUrlResponse} [response] GenerateUploadUrlResponse + */ + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrlCallback} callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.generateUploadUrl = function generateUploadUrl(request, callback) { + return this.rpcCall(generateUploadUrl, $root.google.cloud.functions.v1.GenerateUploadUrlRequest, $root.google.cloud.functions.v1.GenerateUploadUrlResponse, request, callback); + }, "name", { value: "GenerateUploadUrl" }); + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#generateDownloadUrl}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef GenerateDownloadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v1.GenerateDownloadUrlResponse} [response] GenerateDownloadUrlResponse + */ + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrlCallback} callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.generateDownloadUrl = function generateDownloadUrl(request, callback) { + return this.rpcCall(generateDownloadUrl, $root.google.cloud.functions.v1.GenerateDownloadUrlRequest, $root.google.cloud.functions.v1.GenerateDownloadUrlResponse, request, callback); + }, "name", { value: "GenerateDownloadUrl" }); + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.cloud.functions.v1.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#setIamPolicy}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef SetIamPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.Policy} [response] Policy + */ + + /** + * Calls SetIamPolicy. + * @function setIamPolicy + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.iam.v1.ISetIamPolicyRequest} request SetIamPolicyRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.SetIamPolicyCallback} callback Node-style callback called with the error, if any, and Policy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.setIamPolicy = function setIamPolicy(request, callback) { + return this.rpcCall(setIamPolicy, $root.google.iam.v1.SetIamPolicyRequest, $root.google.iam.v1.Policy, request, callback); + }, "name", { value: "SetIamPolicy" }); + + /** + * Calls SetIamPolicy. + * @function setIamPolicy + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.iam.v1.ISetIamPolicyRequest} request SetIamPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#getIamPolicy}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef GetIamPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.Policy} [response] Policy + */ + + /** + * Calls GetIamPolicy. + * @function getIamPolicy + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.iam.v1.IGetIamPolicyRequest} request GetIamPolicyRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.GetIamPolicyCallback} callback Node-style callback called with the error, if any, and Policy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.getIamPolicy = function getIamPolicy(request, callback) { + return this.rpcCall(getIamPolicy, $root.google.iam.v1.GetIamPolicyRequest, $root.google.iam.v1.Policy, request, callback); + }, "name", { value: "GetIamPolicy" }); + + /** + * Calls GetIamPolicy. + * @function getIamPolicy + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.iam.v1.IGetIamPolicyRequest} request GetIamPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#testIamPermissions}. + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @typedef TestIamPermissionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.TestIamPermissionsResponse} [response] TestIamPermissionsResponse + */ + + /** + * Calls TestIamPermissions. + * @function testIamPermissions + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.iam.v1.ITestIamPermissionsRequest} request TestIamPermissionsRequest message or plain object + * @param {google.cloud.functions.v1.CloudFunctionsService.TestIamPermissionsCallback} callback Node-style callback called with the error, if any, and TestIamPermissionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudFunctionsService.prototype.testIamPermissions = function testIamPermissions(request, callback) { + return this.rpcCall(testIamPermissions, $root.google.iam.v1.TestIamPermissionsRequest, $root.google.iam.v1.TestIamPermissionsResponse, request, callback); + }, "name", { value: "TestIamPermissions" }); + + /** + * Calls TestIamPermissions. + * @function testIamPermissions + * @memberof google.cloud.functions.v1.CloudFunctionsService + * @instance + * @param {google.iam.v1.ITestIamPermissionsRequest} request TestIamPermissionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CloudFunctionsService; + })(); + + v1.CloudFunction = (function() { + + /** + * Properties of a CloudFunction. + * @memberof google.cloud.functions.v1 + * @interface ICloudFunction + * @property {string|null} [name] CloudFunction name + * @property {string|null} [description] CloudFunction description + * @property {string|null} [sourceArchiveUrl] CloudFunction sourceArchiveUrl + * @property {google.cloud.functions.v1.ISourceRepository|null} [sourceRepository] CloudFunction sourceRepository + * @property {string|null} [sourceUploadUrl] CloudFunction sourceUploadUrl + * @property {google.cloud.functions.v1.IHttpsTrigger|null} [httpsTrigger] CloudFunction httpsTrigger + * @property {google.cloud.functions.v1.IEventTrigger|null} [eventTrigger] CloudFunction eventTrigger + * @property {google.cloud.functions.v1.CloudFunctionStatus|null} [status] CloudFunction status + * @property {string|null} [entryPoint] CloudFunction entryPoint + * @property {string|null} [runtime] CloudFunction runtime + * @property {google.protobuf.IDuration|null} [timeout] CloudFunction timeout + * @property {number|null} [availableMemoryMb] CloudFunction availableMemoryMb + * @property {string|null} [serviceAccountEmail] CloudFunction serviceAccountEmail + * @property {google.protobuf.ITimestamp|null} [updateTime] CloudFunction updateTime + * @property {number|Long|null} [versionId] CloudFunction versionId + * @property {Object.|null} [labels] CloudFunction labels + * @property {Object.|null} [environmentVariables] CloudFunction environmentVariables + * @property {string|null} [network] CloudFunction network + * @property {number|null} [maxInstances] CloudFunction maxInstances + * @property {string|null} [vpcConnector] CloudFunction vpcConnector + * @property {google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings|null} [vpcConnectorEgressSettings] CloudFunction vpcConnectorEgressSettings + * @property {google.cloud.functions.v1.CloudFunction.IngressSettings|null} [ingressSettings] CloudFunction ingressSettings + * @property {string|null} [buildId] CloudFunction buildId + */ + + /** + * Constructs a new CloudFunction. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a CloudFunction. + * @implements ICloudFunction + * @constructor + * @param {google.cloud.functions.v1.ICloudFunction=} [properties] Properties to set + */ + function CloudFunction(properties) { + this.labels = {}; + this.environmentVariables = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloudFunction name. + * @member {string} name + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.name = ""; + + /** + * CloudFunction description. + * @member {string} description + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.description = ""; + + /** + * CloudFunction sourceArchiveUrl. + * @member {string} sourceArchiveUrl + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.sourceArchiveUrl = ""; + + /** + * CloudFunction sourceRepository. + * @member {google.cloud.functions.v1.ISourceRepository|null|undefined} sourceRepository + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.sourceRepository = null; + + /** + * CloudFunction sourceUploadUrl. + * @member {string} sourceUploadUrl + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.sourceUploadUrl = ""; + + /** + * CloudFunction httpsTrigger. + * @member {google.cloud.functions.v1.IHttpsTrigger|null|undefined} httpsTrigger + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.httpsTrigger = null; + + /** + * CloudFunction eventTrigger. + * @member {google.cloud.functions.v1.IEventTrigger|null|undefined} eventTrigger + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.eventTrigger = null; + + /** + * CloudFunction status. + * @member {google.cloud.functions.v1.CloudFunctionStatus} status + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.status = 0; + + /** + * CloudFunction entryPoint. + * @member {string} entryPoint + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.entryPoint = ""; + + /** + * CloudFunction runtime. + * @member {string} runtime + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.runtime = ""; + + /** + * CloudFunction timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.timeout = null; + + /** + * CloudFunction availableMemoryMb. + * @member {number} availableMemoryMb + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.availableMemoryMb = 0; + + /** + * CloudFunction serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.serviceAccountEmail = ""; + + /** + * CloudFunction updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.updateTime = null; + + /** + * CloudFunction versionId. + * @member {number|Long} versionId + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.versionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * CloudFunction labels. + * @member {Object.} labels + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.labels = $util.emptyObject; + + /** + * CloudFunction environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.environmentVariables = $util.emptyObject; + + /** + * CloudFunction network. + * @member {string} network + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.network = ""; + + /** + * CloudFunction maxInstances. + * @member {number} maxInstances + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.maxInstances = 0; + + /** + * CloudFunction vpcConnector. + * @member {string} vpcConnector + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.vpcConnector = ""; + + /** + * CloudFunction vpcConnectorEgressSettings. + * @member {google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings} vpcConnectorEgressSettings + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.vpcConnectorEgressSettings = 0; + + /** + * CloudFunction ingressSettings. + * @member {google.cloud.functions.v1.CloudFunction.IngressSettings} ingressSettings + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.ingressSettings = 0; + + /** + * CloudFunction buildId. + * @member {string} buildId + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.buildId = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CloudFunction sourceCode. + * @member {"sourceArchiveUrl"|"sourceRepository"|"sourceUploadUrl"|undefined} sourceCode + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + Object.defineProperty(CloudFunction.prototype, "sourceCode", { + get: $util.oneOfGetter($oneOfFields = ["sourceArchiveUrl", "sourceRepository", "sourceUploadUrl"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * CloudFunction trigger. + * @member {"httpsTrigger"|"eventTrigger"|undefined} trigger + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + Object.defineProperty(CloudFunction.prototype, "trigger", { + get: $util.oneOfGetter($oneOfFields = ["httpsTrigger", "eventTrigger"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CloudFunction instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {google.cloud.functions.v1.ICloudFunction=} [properties] Properties to set + * @returns {google.cloud.functions.v1.CloudFunction} CloudFunction instance + */ + CloudFunction.create = function create(properties) { + return new CloudFunction(properties); + }; + + /** + * Encodes the specified CloudFunction message. Does not implicitly {@link google.cloud.functions.v1.CloudFunction.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {google.cloud.functions.v1.ICloudFunction} message CloudFunction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudFunction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.sourceArchiveUrl != null && Object.hasOwnProperty.call(message, "sourceArchiveUrl")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sourceArchiveUrl); + if (message.sourceRepository != null && Object.hasOwnProperty.call(message, "sourceRepository")) + $root.google.cloud.functions.v1.SourceRepository.encode(message.sourceRepository, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.httpsTrigger != null && Object.hasOwnProperty.call(message, "httpsTrigger")) + $root.google.cloud.functions.v1.HttpsTrigger.encode(message.httpsTrigger, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.eventTrigger != null && Object.hasOwnProperty.call(message, "eventTrigger")) + $root.google.cloud.functions.v1.EventTrigger.encode(message.eventTrigger, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.status); + if (message.entryPoint != null && Object.hasOwnProperty.call(message, "entryPoint")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.entryPoint); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.availableMemoryMb != null && Object.hasOwnProperty.call(message, "availableMemoryMb")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.availableMemoryMb); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.serviceAccountEmail); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.versionId != null && Object.hasOwnProperty.call(message, "versionId")) + writer.uint32(/* id 14, wireType 0 =*/112).int64(message.versionId); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.sourceUploadUrl != null && Object.hasOwnProperty.call(message, "sourceUploadUrl")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.sourceUploadUrl); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environmentVariables[keys[i]]).ldelim(); + if (message.network != null && Object.hasOwnProperty.call(message, "network")) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.network); + if (message.runtime != null && Object.hasOwnProperty.call(message, "runtime")) + writer.uint32(/* id 19, wireType 2 =*/154).string(message.runtime); + if (message.maxInstances != null && Object.hasOwnProperty.call(message, "maxInstances")) + writer.uint32(/* id 20, wireType 0 =*/160).int32(message.maxInstances); + if (message.vpcConnector != null && Object.hasOwnProperty.call(message, "vpcConnector")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.vpcConnector); + if (message.vpcConnectorEgressSettings != null && Object.hasOwnProperty.call(message, "vpcConnectorEgressSettings")) + writer.uint32(/* id 23, wireType 0 =*/184).int32(message.vpcConnectorEgressSettings); + if (message.ingressSettings != null && Object.hasOwnProperty.call(message, "ingressSettings")) + writer.uint32(/* id 24, wireType 0 =*/192).int32(message.ingressSettings); + if (message.buildId != null && Object.hasOwnProperty.call(message, "buildId")) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.buildId); + return writer; + }; + + /** + * Encodes the specified CloudFunction message, length delimited. Does not implicitly {@link google.cloud.functions.v1.CloudFunction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {google.cloud.functions.v1.ICloudFunction} message CloudFunction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudFunction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CloudFunction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.CloudFunction} CloudFunction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudFunction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.CloudFunction(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.sourceArchiveUrl = reader.string(); + break; + case 4: + message.sourceRepository = $root.google.cloud.functions.v1.SourceRepository.decode(reader, reader.uint32()); + break; + case 16: + message.sourceUploadUrl = reader.string(); + break; + case 5: + message.httpsTrigger = $root.google.cloud.functions.v1.HttpsTrigger.decode(reader, reader.uint32()); + break; + case 6: + message.eventTrigger = $root.google.cloud.functions.v1.EventTrigger.decode(reader, reader.uint32()); + break; + case 7: + message.status = reader.int32(); + break; + case 8: + message.entryPoint = reader.string(); + break; + case 19: + message.runtime = reader.string(); + break; + case 9: + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 10: + message.availableMemoryMb = reader.int32(); + break; + case 11: + message.serviceAccountEmail = reader.string(); + break; + case 12: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 14: + message.versionId = reader.int64(); + break; + case 15: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 17: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.environmentVariables[key] = value; + break; + case 18: + message.network = reader.string(); + break; + case 20: + message.maxInstances = reader.int32(); + break; + case 22: + message.vpcConnector = reader.string(); + break; + case 23: + message.vpcConnectorEgressSettings = reader.int32(); + break; + case 24: + message.ingressSettings = reader.int32(); + break; + case 27: + message.buildId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CloudFunction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.CloudFunction} CloudFunction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudFunction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloudFunction message. + * @function verify + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloudFunction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.sourceArchiveUrl != null && message.hasOwnProperty("sourceArchiveUrl")) { + properties.sourceCode = 1; + if (!$util.isString(message.sourceArchiveUrl)) + return "sourceArchiveUrl: string expected"; + } + if (message.sourceRepository != null && message.hasOwnProperty("sourceRepository")) { + if (properties.sourceCode === 1) + return "sourceCode: multiple values"; + properties.sourceCode = 1; + { + var error = $root.google.cloud.functions.v1.SourceRepository.verify(message.sourceRepository); + if (error) + return "sourceRepository." + error; + } + } + if (message.sourceUploadUrl != null && message.hasOwnProperty("sourceUploadUrl")) { + if (properties.sourceCode === 1) + return "sourceCode: multiple values"; + properties.sourceCode = 1; + if (!$util.isString(message.sourceUploadUrl)) + return "sourceUploadUrl: string expected"; + } + if (message.httpsTrigger != null && message.hasOwnProperty("httpsTrigger")) { + properties.trigger = 1; + { + var error = $root.google.cloud.functions.v1.HttpsTrigger.verify(message.httpsTrigger); + if (error) + return "httpsTrigger." + error; + } + } + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) { + if (properties.trigger === 1) + return "trigger: multiple values"; + properties.trigger = 1; + { + var error = $root.google.cloud.functions.v1.EventTrigger.verify(message.eventTrigger); + if (error) + return "eventTrigger." + error; + } + } + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + if (!$util.isString(message.entryPoint)) + return "entryPoint: string expected"; + if (message.runtime != null && message.hasOwnProperty("runtime")) + if (!$util.isString(message.runtime)) + return "runtime: string expected"; + if (message.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + if (message.availableMemoryMb != null && message.hasOwnProperty("availableMemoryMb")) + if (!$util.isInteger(message.availableMemoryMb)) + return "availableMemoryMb: integer expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.versionId != null && message.hasOwnProperty("versionId")) + if (!$util.isInteger(message.versionId) && !(message.versionId && $util.isInteger(message.versionId.low) && $util.isInteger(message.versionId.high))) + return "versionId: integer|Long expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.network != null && message.hasOwnProperty("network")) + if (!$util.isString(message.network)) + return "network: string expected"; + if (message.maxInstances != null && message.hasOwnProperty("maxInstances")) + if (!$util.isInteger(message.maxInstances)) + return "maxInstances: integer expected"; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + if (!$util.isString(message.vpcConnector)) + return "vpcConnector: string expected"; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + switch (message.vpcConnectorEgressSettings) { + default: + return "vpcConnectorEgressSettings: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + switch (message.ingressSettings) { + default: + return "ingressSettings: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.buildId != null && message.hasOwnProperty("buildId")) + if (!$util.isString(message.buildId)) + return "buildId: string expected"; + return null; + }; + + /** + * Creates a CloudFunction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.CloudFunction} CloudFunction + */ + CloudFunction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.CloudFunction) + return object; + var message = new $root.google.cloud.functions.v1.CloudFunction(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.sourceArchiveUrl != null) + message.sourceArchiveUrl = String(object.sourceArchiveUrl); + if (object.sourceRepository != null) { + if (typeof object.sourceRepository !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.sourceRepository: object expected"); + message.sourceRepository = $root.google.cloud.functions.v1.SourceRepository.fromObject(object.sourceRepository); + } + if (object.sourceUploadUrl != null) + message.sourceUploadUrl = String(object.sourceUploadUrl); + if (object.httpsTrigger != null) { + if (typeof object.httpsTrigger !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.httpsTrigger: object expected"); + message.httpsTrigger = $root.google.cloud.functions.v1.HttpsTrigger.fromObject(object.httpsTrigger); + } + if (object.eventTrigger != null) { + if (typeof object.eventTrigger !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.eventTrigger: object expected"); + message.eventTrigger = $root.google.cloud.functions.v1.EventTrigger.fromObject(object.eventTrigger); + } + switch (object.status) { + case "CLOUD_FUNCTION_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "ACTIVE": + case 1: + message.status = 1; + break; + case "OFFLINE": + case 2: + message.status = 2; + break; + case "DEPLOY_IN_PROGRESS": + case 3: + message.status = 3; + break; + case "DELETE_IN_PROGRESS": + case 4: + message.status = 4; + break; + case "UNKNOWN": + case 5: + message.status = 5; + break; + } + if (object.entryPoint != null) + message.entryPoint = String(object.entryPoint); + if (object.runtime != null) + message.runtime = String(object.runtime); + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + if (object.availableMemoryMb != null) + message.availableMemoryMb = object.availableMemoryMb | 0; + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.versionId != null) + if ($util.Long) + (message.versionId = $util.Long.fromValue(object.versionId)).unsigned = false; + else if (typeof object.versionId === "string") + message.versionId = parseInt(object.versionId, 10); + else if (typeof object.versionId === "number") + message.versionId = object.versionId; + else if (typeof object.versionId === "object") + message.versionId = new $util.LongBits(object.versionId.low >>> 0, object.versionId.high >>> 0).toNumber(); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.network != null) + message.network = String(object.network); + if (object.maxInstances != null) + message.maxInstances = object.maxInstances | 0; + if (object.vpcConnector != null) + message.vpcConnector = String(object.vpcConnector); + switch (object.vpcConnectorEgressSettings) { + case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.vpcConnectorEgressSettings = 0; + break; + case "PRIVATE_RANGES_ONLY": + case 1: + message.vpcConnectorEgressSettings = 1; + break; + case "ALL_TRAFFIC": + case 2: + message.vpcConnectorEgressSettings = 2; + break; + } + switch (object.ingressSettings) { + case "INGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.ingressSettings = 0; + break; + case "ALLOW_ALL": + case 1: + message.ingressSettings = 1; + break; + case "ALLOW_INTERNAL_ONLY": + case 2: + message.ingressSettings = 2; + break; + case "ALLOW_INTERNAL_AND_GCLB": + case 3: + message.ingressSettings = 3; + break; + } + if (object.buildId != null) + message.buildId = String(object.buildId); + return message; + }; + + /** + * Creates a plain object from a CloudFunction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {google.cloud.functions.v1.CloudFunction} message CloudFunction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloudFunction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) { + object.labels = {}; + object.environmentVariables = {}; + } + if (options.defaults) { + object.name = ""; + object.description = ""; + object.status = options.enums === String ? "CLOUD_FUNCTION_STATUS_UNSPECIFIED" : 0; + object.entryPoint = ""; + object.timeout = null; + object.availableMemoryMb = 0; + object.serviceAccountEmail = ""; + object.updateTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.versionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.versionId = options.longs === String ? "0" : 0; + object.network = ""; + object.runtime = ""; + object.maxInstances = 0; + object.vpcConnector = ""; + object.vpcConnectorEgressSettings = options.enums === String ? "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" : 0; + object.ingressSettings = options.enums === String ? "INGRESS_SETTINGS_UNSPECIFIED" : 0; + object.buildId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.sourceArchiveUrl != null && message.hasOwnProperty("sourceArchiveUrl")) { + object.sourceArchiveUrl = message.sourceArchiveUrl; + if (options.oneofs) + object.sourceCode = "sourceArchiveUrl"; + } + if (message.sourceRepository != null && message.hasOwnProperty("sourceRepository")) { + object.sourceRepository = $root.google.cloud.functions.v1.SourceRepository.toObject(message.sourceRepository, options); + if (options.oneofs) + object.sourceCode = "sourceRepository"; + } + if (message.httpsTrigger != null && message.hasOwnProperty("httpsTrigger")) { + object.httpsTrigger = $root.google.cloud.functions.v1.HttpsTrigger.toObject(message.httpsTrigger, options); + if (options.oneofs) + object.trigger = "httpsTrigger"; + } + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) { + object.eventTrigger = $root.google.cloud.functions.v1.EventTrigger.toObject(message.eventTrigger, options); + if (options.oneofs) + object.trigger = "eventTrigger"; + } + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.google.cloud.functions.v1.CloudFunctionStatus[message.status] : message.status; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + object.entryPoint = message.entryPoint; + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + if (message.availableMemoryMb != null && message.hasOwnProperty("availableMemoryMb")) + object.availableMemoryMb = message.availableMemoryMb; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.versionId != null && message.hasOwnProperty("versionId")) + if (typeof message.versionId === "number") + object.versionId = options.longs === String ? String(message.versionId) : message.versionId; + else + object.versionId = options.longs === String ? $util.Long.prototype.toString.call(message.versionId) : options.longs === Number ? new $util.LongBits(message.versionId.low >>> 0, message.versionId.high >>> 0).toNumber() : message.versionId; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.sourceUploadUrl != null && message.hasOwnProperty("sourceUploadUrl")) { + object.sourceUploadUrl = message.sourceUploadUrl; + if (options.oneofs) + object.sourceCode = "sourceUploadUrl"; + } + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.network != null && message.hasOwnProperty("network")) + object.network = message.network; + if (message.runtime != null && message.hasOwnProperty("runtime")) + object.runtime = message.runtime; + if (message.maxInstances != null && message.hasOwnProperty("maxInstances")) + object.maxInstances = message.maxInstances; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + object.vpcConnector = message.vpcConnector; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.IngressSettings[message.ingressSettings] : message.ingressSettings; + if (message.buildId != null && message.hasOwnProperty("buildId")) + object.buildId = message.buildId; + return object; + }; + + /** + * Converts this CloudFunction to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + * @returns {Object.} JSON object + */ + CloudFunction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * VpcConnectorEgressSettings enum. + * @name google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings + * @enum {number} + * @property {number} VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED=0 VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED value + * @property {number} PRIVATE_RANGES_ONLY=1 PRIVATE_RANGES_ONLY value + * @property {number} ALL_TRAFFIC=2 ALL_TRAFFIC value + */ + CloudFunction.VpcConnectorEgressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIVATE_RANGES_ONLY"] = 1; + values[valuesById[2] = "ALL_TRAFFIC"] = 2; + return values; + })(); + + /** + * IngressSettings enum. + * @name google.cloud.functions.v1.CloudFunction.IngressSettings + * @enum {number} + * @property {number} INGRESS_SETTINGS_UNSPECIFIED=0 INGRESS_SETTINGS_UNSPECIFIED value + * @property {number} ALLOW_ALL=1 ALLOW_ALL value + * @property {number} ALLOW_INTERNAL_ONLY=2 ALLOW_INTERNAL_ONLY value + * @property {number} ALLOW_INTERNAL_AND_GCLB=3 ALLOW_INTERNAL_AND_GCLB value + */ + CloudFunction.IngressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALLOW_ALL"] = 1; + values[valuesById[2] = "ALLOW_INTERNAL_ONLY"] = 2; + values[valuesById[3] = "ALLOW_INTERNAL_AND_GCLB"] = 3; + return values; + })(); + + return CloudFunction; + })(); + + v1.SourceRepository = (function() { + + /** + * Properties of a SourceRepository. + * @memberof google.cloud.functions.v1 + * @interface ISourceRepository + * @property {string|null} [url] SourceRepository url + * @property {string|null} [deployedUrl] SourceRepository deployedUrl + */ + + /** + * Constructs a new SourceRepository. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a SourceRepository. + * @implements ISourceRepository + * @constructor + * @param {google.cloud.functions.v1.ISourceRepository=} [properties] Properties to set + */ + function SourceRepository(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceRepository url. + * @member {string} url + * @memberof google.cloud.functions.v1.SourceRepository + * @instance + */ + SourceRepository.prototype.url = ""; + + /** + * SourceRepository deployedUrl. + * @member {string} deployedUrl + * @memberof google.cloud.functions.v1.SourceRepository + * @instance + */ + SourceRepository.prototype.deployedUrl = ""; + + /** + * Creates a new SourceRepository instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {google.cloud.functions.v1.ISourceRepository=} [properties] Properties to set + * @returns {google.cloud.functions.v1.SourceRepository} SourceRepository instance + */ + SourceRepository.create = function create(properties) { + return new SourceRepository(properties); + }; + + /** + * Encodes the specified SourceRepository message. Does not implicitly {@link google.cloud.functions.v1.SourceRepository.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {google.cloud.functions.v1.ISourceRepository} message SourceRepository message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceRepository.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.deployedUrl != null && Object.hasOwnProperty.call(message, "deployedUrl")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.deployedUrl); + return writer; + }; + + /** + * Encodes the specified SourceRepository message, length delimited. Does not implicitly {@link google.cloud.functions.v1.SourceRepository.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {google.cloud.functions.v1.ISourceRepository} message SourceRepository message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceRepository.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceRepository message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.SourceRepository} SourceRepository + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceRepository.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.SourceRepository(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.deployedUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceRepository message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.SourceRepository} SourceRepository + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceRepository.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceRepository message. + * @function verify + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceRepository.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.deployedUrl != null && message.hasOwnProperty("deployedUrl")) + if (!$util.isString(message.deployedUrl)) + return "deployedUrl: string expected"; + return null; + }; + + /** + * Creates a SourceRepository message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.SourceRepository} SourceRepository + */ + SourceRepository.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.SourceRepository) + return object; + var message = new $root.google.cloud.functions.v1.SourceRepository(); + if (object.url != null) + message.url = String(object.url); + if (object.deployedUrl != null) + message.deployedUrl = String(object.deployedUrl); + return message; + }; + + /** + * Creates a plain object from a SourceRepository message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {google.cloud.functions.v1.SourceRepository} message SourceRepository + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceRepository.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + object.deployedUrl = ""; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.deployedUrl != null && message.hasOwnProperty("deployedUrl")) + object.deployedUrl = message.deployedUrl; + return object; + }; + + /** + * Converts this SourceRepository to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.SourceRepository + * @instance + * @returns {Object.} JSON object + */ + SourceRepository.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SourceRepository; + })(); + + v1.HttpsTrigger = (function() { + + /** + * Properties of a HttpsTrigger. + * @memberof google.cloud.functions.v1 + * @interface IHttpsTrigger + * @property {string|null} [url] HttpsTrigger url + */ + + /** + * Constructs a new HttpsTrigger. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a HttpsTrigger. + * @implements IHttpsTrigger + * @constructor + * @param {google.cloud.functions.v1.IHttpsTrigger=} [properties] Properties to set + */ + function HttpsTrigger(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpsTrigger url. + * @member {string} url + * @memberof google.cloud.functions.v1.HttpsTrigger + * @instance + */ + HttpsTrigger.prototype.url = ""; + + /** + * Creates a new HttpsTrigger instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {google.cloud.functions.v1.IHttpsTrigger=} [properties] Properties to set + * @returns {google.cloud.functions.v1.HttpsTrigger} HttpsTrigger instance + */ + HttpsTrigger.create = function create(properties) { + return new HttpsTrigger(properties); + }; + + /** + * Encodes the specified HttpsTrigger message. Does not implicitly {@link google.cloud.functions.v1.HttpsTrigger.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {google.cloud.functions.v1.IHttpsTrigger} message HttpsTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpsTrigger.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + return writer; + }; + + /** + * Encodes the specified HttpsTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v1.HttpsTrigger.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {google.cloud.functions.v1.IHttpsTrigger} message HttpsTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpsTrigger.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpsTrigger message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.HttpsTrigger} HttpsTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpsTrigger.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.HttpsTrigger(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpsTrigger message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.HttpsTrigger} HttpsTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpsTrigger.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpsTrigger message. + * @function verify + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpsTrigger.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + return null; + }; + + /** + * Creates a HttpsTrigger message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.HttpsTrigger} HttpsTrigger + */ + HttpsTrigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.HttpsTrigger) + return object; + var message = new $root.google.cloud.functions.v1.HttpsTrigger(); + if (object.url != null) + message.url = String(object.url); + return message; + }; + + /** + * Creates a plain object from a HttpsTrigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {google.cloud.functions.v1.HttpsTrigger} message HttpsTrigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpsTrigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.url = ""; + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + return object; + }; + + /** + * Converts this HttpsTrigger to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.HttpsTrigger + * @instance + * @returns {Object.} JSON object + */ + HttpsTrigger.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpsTrigger; + })(); + + v1.EventTrigger = (function() { + + /** + * Properties of an EventTrigger. + * @memberof google.cloud.functions.v1 + * @interface IEventTrigger + * @property {string|null} [eventType] EventTrigger eventType + * @property {string|null} [resource] EventTrigger resource + * @property {string|null} [service] EventTrigger service + * @property {google.cloud.functions.v1.IFailurePolicy|null} [failurePolicy] EventTrigger failurePolicy + */ + + /** + * Constructs a new EventTrigger. + * @memberof google.cloud.functions.v1 + * @classdesc Represents an EventTrigger. + * @implements IEventTrigger + * @constructor + * @param {google.cloud.functions.v1.IEventTrigger=} [properties] Properties to set + */ + function EventTrigger(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventTrigger eventType. + * @member {string} eventType + * @memberof google.cloud.functions.v1.EventTrigger + * @instance + */ + EventTrigger.prototype.eventType = ""; + + /** + * EventTrigger resource. + * @member {string} resource + * @memberof google.cloud.functions.v1.EventTrigger + * @instance + */ + EventTrigger.prototype.resource = ""; + + /** + * EventTrigger service. + * @member {string} service + * @memberof google.cloud.functions.v1.EventTrigger + * @instance + */ + EventTrigger.prototype.service = ""; + + /** + * EventTrigger failurePolicy. + * @member {google.cloud.functions.v1.IFailurePolicy|null|undefined} failurePolicy + * @memberof google.cloud.functions.v1.EventTrigger + * @instance + */ + EventTrigger.prototype.failurePolicy = null; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {google.cloud.functions.v1.IEventTrigger=} [properties] Properties to set + * @returns {google.cloud.functions.v1.EventTrigger} EventTrigger instance + */ + EventTrigger.create = function create(properties) { + return new EventTrigger(properties); + }; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v1.EventTrigger.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {google.cloud.functions.v1.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.eventType); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.resource); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.service); + if (message.failurePolicy != null && Object.hasOwnProperty.call(message, "failurePolicy")) + $root.google.cloud.functions.v1.FailurePolicy.encode(message.failurePolicy, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v1.EventTrigger.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {google.cloud.functions.v1.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.EventTrigger(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.eventType = reader.string(); + break; + case 2: + message.resource = reader.string(); + break; + case 3: + message.service = reader.string(); + break; + case 5: + message.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventTrigger message. + * @function verify + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventTrigger.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.failurePolicy != null && message.hasOwnProperty("failurePolicy")) { + var error = $root.google.cloud.functions.v1.FailurePolicy.verify(message.failurePolicy); + if (error) + return "failurePolicy." + error; + } + return null; + }; + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.EventTrigger} EventTrigger + */ + EventTrigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.EventTrigger) + return object; + var message = new $root.google.cloud.functions.v1.EventTrigger(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.resource != null) + message.resource = String(object.resource); + if (object.service != null) + message.service = String(object.service); + if (object.failurePolicy != null) { + if (typeof object.failurePolicy !== "object") + throw TypeError(".google.cloud.functions.v1.EventTrigger.failurePolicy: object expected"); + message.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.fromObject(object.failurePolicy); + } + return message; + }; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {google.cloud.functions.v1.EventTrigger} message EventTrigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventTrigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventType = ""; + object.resource = ""; + object.service = ""; + object.failurePolicy = null; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.failurePolicy != null && message.hasOwnProperty("failurePolicy")) + object.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.toObject(message.failurePolicy, options); + return object; + }; + + /** + * Converts this EventTrigger to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.EventTrigger + * @instance + * @returns {Object.} JSON object + */ + EventTrigger.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventTrigger; + })(); + + v1.FailurePolicy = (function() { + + /** + * Properties of a FailurePolicy. + * @memberof google.cloud.functions.v1 + * @interface IFailurePolicy + * @property {google.cloud.functions.v1.FailurePolicy.IRetry|null} [retry] FailurePolicy retry + */ + + /** + * Constructs a new FailurePolicy. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a FailurePolicy. + * @implements IFailurePolicy + * @constructor + * @param {google.cloud.functions.v1.IFailurePolicy=} [properties] Properties to set + */ + function FailurePolicy(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FailurePolicy retry. + * @member {google.cloud.functions.v1.FailurePolicy.IRetry|null|undefined} retry + * @memberof google.cloud.functions.v1.FailurePolicy + * @instance + */ + FailurePolicy.prototype.retry = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FailurePolicy action. + * @member {"retry"|undefined} action + * @memberof google.cloud.functions.v1.FailurePolicy + * @instance + */ + Object.defineProperty(FailurePolicy.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["retry"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FailurePolicy instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {google.cloud.functions.v1.IFailurePolicy=} [properties] Properties to set + * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy instance + */ + FailurePolicy.create = function create(properties) { + return new FailurePolicy(properties); + }; + + /** + * Encodes the specified FailurePolicy message. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {google.cloud.functions.v1.IFailurePolicy} message FailurePolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailurePolicy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.retry != null && Object.hasOwnProperty.call(message, "retry")) + $root.google.cloud.functions.v1.FailurePolicy.Retry.encode(message.retry, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FailurePolicy message, length delimited. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {google.cloud.functions.v1.IFailurePolicy} message FailurePolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailurePolicy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FailurePolicy message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailurePolicy.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.FailurePolicy(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FailurePolicy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailurePolicy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FailurePolicy message. + * @function verify + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FailurePolicy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.retry != null && message.hasOwnProperty("retry")) { + properties.action = 1; + { + var error = $root.google.cloud.functions.v1.FailurePolicy.Retry.verify(message.retry); + if (error) + return "retry." + error; + } + } + return null; + }; + + /** + * Creates a FailurePolicy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + */ + FailurePolicy.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.FailurePolicy) + return object; + var message = new $root.google.cloud.functions.v1.FailurePolicy(); + if (object.retry != null) { + if (typeof object.retry !== "object") + throw TypeError(".google.cloud.functions.v1.FailurePolicy.retry: object expected"); + message.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.fromObject(object.retry); + } + return message; + }; + + /** + * Creates a plain object from a FailurePolicy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {google.cloud.functions.v1.FailurePolicy} message FailurePolicy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FailurePolicy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.retry != null && message.hasOwnProperty("retry")) { + object.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.toObject(message.retry, options); + if (options.oneofs) + object.action = "retry"; + } + return object; + }; + + /** + * Converts this FailurePolicy to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.FailurePolicy + * @instance + * @returns {Object.} JSON object + */ + FailurePolicy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + FailurePolicy.Retry = (function() { + + /** + * Properties of a Retry. + * @memberof google.cloud.functions.v1.FailurePolicy + * @interface IRetry + */ + + /** + * Constructs a new Retry. + * @memberof google.cloud.functions.v1.FailurePolicy + * @classdesc Represents a Retry. + * @implements IRetry + * @constructor + * @param {google.cloud.functions.v1.FailurePolicy.IRetry=} [properties] Properties to set + */ + function Retry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Retry instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {google.cloud.functions.v1.FailurePolicy.IRetry=} [properties] Properties to set + * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry instance + */ + Retry.create = function create(properties) { + return new Retry(properties); + }; + + /** + * Encodes the specified Retry message. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.Retry.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {google.cloud.functions.v1.FailurePolicy.IRetry} message Retry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Retry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Retry message, length delimited. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.Retry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {google.cloud.functions.v1.FailurePolicy.IRetry} message Retry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Retry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Retry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Retry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.FailurePolicy.Retry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Retry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Retry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Retry message. + * @function verify + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Retry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a Retry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + */ + Retry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.FailurePolicy.Retry) + return object; + return new $root.google.cloud.functions.v1.FailurePolicy.Retry(); + }; + + /** + * Creates a plain object from a Retry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {google.cloud.functions.v1.FailurePolicy.Retry} message Retry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Retry.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Retry to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @instance + * @returns {Object.} JSON object + */ + Retry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Retry; + })(); + + return FailurePolicy; + })(); + + v1.CreateFunctionRequest = (function() { + + /** + * Properties of a CreateFunctionRequest. + * @memberof google.cloud.functions.v1 + * @interface ICreateFunctionRequest + * @property {string|null} [location] CreateFunctionRequest location + * @property {google.cloud.functions.v1.ICloudFunction|null} ["function"] CreateFunctionRequest function + */ + + /** + * Constructs a new CreateFunctionRequest. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a CreateFunctionRequest. + * @implements ICreateFunctionRequest + * @constructor + * @param {google.cloud.functions.v1.ICreateFunctionRequest=} [properties] Properties to set + */ + function CreateFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateFunctionRequest location. + * @member {string} location + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.location = ""; + + /** + * CreateFunctionRequest function. + * @member {google.cloud.functions.v1.ICloudFunction|null|undefined} function + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype["function"] = null; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v1.ICreateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v1.CreateFunctionRequest} CreateFunctionRequest instance + */ + CreateFunctionRequest.create = function create(properties) { + return new CreateFunctionRequest(properties); + }; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.CreateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v1.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.location); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v1.CloudFunction.encode(message["function"], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.CreateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v1.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.CreateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.location = reader.string(); + break; + case 2: + message["function"] = $root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v1.CloudFunction.verify(message["function"]); + if (error) + return "function." + error; + } + return null; + }; + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.CreateFunctionRequest} CreateFunctionRequest + */ + CreateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.CreateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v1.CreateFunctionRequest(); + if (object.location != null) + message.location = String(object.location); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v1.CreateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v1.CloudFunction.fromObject(object["function"]); + } + return message; + }; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v1.CreateFunctionRequest} message CreateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.location = ""; + object["function"] = null; + } + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v1.CloudFunction.toObject(message["function"], options); + return object; + }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateFunctionRequest; + })(); + + v1.UpdateFunctionRequest = (function() { + + /** + * Properties of an UpdateFunctionRequest. + * @memberof google.cloud.functions.v1 + * @interface IUpdateFunctionRequest + * @property {google.cloud.functions.v1.ICloudFunction|null} ["function"] UpdateFunctionRequest function + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFunctionRequest updateMask + */ + + /** + * Constructs a new UpdateFunctionRequest. + * @memberof google.cloud.functions.v1 + * @classdesc Represents an UpdateFunctionRequest. + * @implements IUpdateFunctionRequest + * @constructor + * @param {google.cloud.functions.v1.IUpdateFunctionRequest=} [properties] Properties to set + */ + function UpdateFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateFunctionRequest function. + * @member {google.cloud.functions.v1.ICloudFunction|null|undefined} function + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype["function"] = null; + + /** + * UpdateFunctionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v1.IUpdateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v1.UpdateFunctionRequest} UpdateFunctionRequest instance + */ + UpdateFunctionRequest.create = function create(properties) { + return new UpdateFunctionRequest(properties); + }; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.UpdateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v1.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v1.CloudFunction.encode(message["function"], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.UpdateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v1.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.UpdateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["function"] = $root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v1.CloudFunction.verify(message["function"]); + if (error) + return "function." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.UpdateFunctionRequest} UpdateFunctionRequest + */ + UpdateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.UpdateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v1.UpdateFunctionRequest(); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v1.UpdateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v1.CloudFunction.fromObject(object["function"]); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.functions.v1.UpdateFunctionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v1.UpdateFunctionRequest} message UpdateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object["function"] = null; + object.updateMask = null; + } + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v1.CloudFunction.toObject(message["function"], options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateFunctionRequest; + })(); + + v1.GetFunctionRequest = (function() { + + /** + * Properties of a GetFunctionRequest. + * @memberof google.cloud.functions.v1 + * @interface IGetFunctionRequest + * @property {string|null} [name] GetFunctionRequest name + */ + + /** + * Constructs a new GetFunctionRequest. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a GetFunctionRequest. + * @implements IGetFunctionRequest + * @constructor + * @param {google.cloud.functions.v1.IGetFunctionRequest=} [properties] Properties to set + */ + function GetFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @instance + */ + GetFunctionRequest.prototype.name = ""; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {google.cloud.functions.v1.IGetFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v1.GetFunctionRequest} GetFunctionRequest instance + */ + GetFunctionRequest.create = function create(properties) { + return new GetFunctionRequest(properties); + }; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.GetFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {google.cloud.functions.v1.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GetFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {google.cloud.functions.v1.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.GetFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.GetFunctionRequest} GetFunctionRequest + */ + GetFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.GetFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v1.GetFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {google.cloud.functions.v1.GetFunctionRequest} message GetFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + GetFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetFunctionRequest; + })(); + + /** + * CloudFunctionStatus enum. + * @name google.cloud.functions.v1.CloudFunctionStatus + * @enum {number} + * @property {number} CLOUD_FUNCTION_STATUS_UNSPECIFIED=0 CLOUD_FUNCTION_STATUS_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} OFFLINE=2 OFFLINE value + * @property {number} DEPLOY_IN_PROGRESS=3 DEPLOY_IN_PROGRESS value + * @property {number} DELETE_IN_PROGRESS=4 DELETE_IN_PROGRESS value + * @property {number} UNKNOWN=5 UNKNOWN value + */ + v1.CloudFunctionStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLOUD_FUNCTION_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "OFFLINE"] = 2; + values[valuesById[3] = "DEPLOY_IN_PROGRESS"] = 3; + values[valuesById[4] = "DELETE_IN_PROGRESS"] = 4; + values[valuesById[5] = "UNKNOWN"] = 5; + return values; + })(); + + v1.ListFunctionsRequest = (function() { + + /** + * Properties of a ListFunctionsRequest. + * @memberof google.cloud.functions.v1 + * @interface IListFunctionsRequest + * @property {string|null} [parent] ListFunctionsRequest parent + * @property {number|null} [pageSize] ListFunctionsRequest pageSize + * @property {string|null} [pageToken] ListFunctionsRequest pageToken + */ + + /** + * Constructs a new ListFunctionsRequest. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a ListFunctionsRequest. + * @implements IListFunctionsRequest + * @constructor + * @param {google.cloud.functions.v1.IListFunctionsRequest=} [properties] Properties to set + */ + function ListFunctionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFunctionsRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.parent = ""; + + /** + * ListFunctionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageSize = 0; + + /** + * ListFunctionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v1.IListFunctionsRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v1.ListFunctionsRequest} ListFunctionsRequest instance + */ + ListFunctionsRequest.create = function create(properties) { + return new ListFunctionsRequest(properties); + }; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v1.ListFunctionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v1.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.ListFunctionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v1.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.ListFunctionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsRequest message. + * @function verify + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.ListFunctionsRequest} ListFunctionsRequest + */ + ListFunctionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.ListFunctionsRequest) + return object; + var message = new $root.google.cloud.functions.v1.ListFunctionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v1.ListFunctionsRequest} message ListFunctionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsRequest; + })(); + + v1.ListFunctionsResponse = (function() { + + /** + * Properties of a ListFunctionsResponse. + * @memberof google.cloud.functions.v1 + * @interface IListFunctionsResponse + * @property {Array.|null} [functions] ListFunctionsResponse functions + * @property {string|null} [nextPageToken] ListFunctionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListFunctionsResponse unreachable + */ + + /** + * Constructs a new ListFunctionsResponse. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a ListFunctionsResponse. + * @implements IListFunctionsResponse + * @constructor + * @param {google.cloud.functions.v1.IListFunctionsResponse=} [properties] Properties to set + */ + function ListFunctionsResponse(properties) { + this.functions = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFunctionsResponse functions. + * @member {Array.} functions + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.functions = $util.emptyArray; + + /** + * ListFunctionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.nextPageToken = ""; + + /** + * ListFunctionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v1.IListFunctionsResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v1.ListFunctionsResponse} ListFunctionsResponse instance + */ + ListFunctionsResponse.create = function create(properties) { + return new ListFunctionsResponse(properties); + }; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v1.ListFunctionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v1.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.functions != null && message.functions.length) + for (var i = 0; i < message.functions.length; ++i) + $root.google.cloud.functions.v1.CloudFunction.encode(message.functions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v1.ListFunctionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v1.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.ListFunctionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsResponse message. + * @function verify + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.functions != null && message.hasOwnProperty("functions")) { + if (!Array.isArray(message.functions)) + return "functions: array expected"; + for (var i = 0; i < message.functions.length; ++i) { + var error = $root.google.cloud.functions.v1.CloudFunction.verify(message.functions[i]); + if (error) + return "functions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.ListFunctionsResponse} ListFunctionsResponse + */ + ListFunctionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.ListFunctionsResponse) + return object; + var message = new $root.google.cloud.functions.v1.ListFunctionsResponse(); + if (object.functions) { + if (!Array.isArray(object.functions)) + throw TypeError(".google.cloud.functions.v1.ListFunctionsResponse.functions: array expected"); + message.functions = []; + for (var i = 0; i < object.functions.length; ++i) { + if (typeof object.functions[i] !== "object") + throw TypeError(".google.cloud.functions.v1.ListFunctionsResponse.functions: object expected"); + message.functions[i] = $root.google.cloud.functions.v1.CloudFunction.fromObject(object.functions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.functions.v1.ListFunctionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v1.ListFunctionsResponse} message ListFunctionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.functions = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.functions && message.functions.length) { + object.functions = []; + for (var j = 0; j < message.functions.length; ++j) + object.functions[j] = $root.google.cloud.functions.v1.CloudFunction.toObject(message.functions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsResponse; + })(); + + v1.DeleteFunctionRequest = (function() { + + /** + * Properties of a DeleteFunctionRequest. + * @memberof google.cloud.functions.v1 + * @interface IDeleteFunctionRequest + * @property {string|null} [name] DeleteFunctionRequest name + */ + + /** + * Constructs a new DeleteFunctionRequest. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a DeleteFunctionRequest. + * @implements IDeleteFunctionRequest + * @constructor + * @param {google.cloud.functions.v1.IDeleteFunctionRequest=} [properties] Properties to set + */ + function DeleteFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @instance + */ + DeleteFunctionRequest.prototype.name = ""; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v1.IDeleteFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v1.DeleteFunctionRequest} DeleteFunctionRequest instance + */ + DeleteFunctionRequest.create = function create(properties) { + return new DeleteFunctionRequest(properties); + }; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.DeleteFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v1.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.DeleteFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v1.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.DeleteFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.DeleteFunctionRequest} DeleteFunctionRequest + */ + DeleteFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.DeleteFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v1.DeleteFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v1.DeleteFunctionRequest} message DeleteFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteFunctionRequest; + })(); + + v1.CallFunctionRequest = (function() { + + /** + * Properties of a CallFunctionRequest. + * @memberof google.cloud.functions.v1 + * @interface ICallFunctionRequest + * @property {string|null} [name] CallFunctionRequest name + * @property {string|null} [data] CallFunctionRequest data + */ + + /** + * Constructs a new CallFunctionRequest. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a CallFunctionRequest. + * @implements ICallFunctionRequest + * @constructor + * @param {google.cloud.functions.v1.ICallFunctionRequest=} [properties] Properties to set + */ + function CallFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CallFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @instance + */ + CallFunctionRequest.prototype.name = ""; + + /** + * CallFunctionRequest data. + * @member {string} data + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @instance + */ + CallFunctionRequest.prototype.data = ""; + + /** + * Creates a new CallFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {google.cloud.functions.v1.ICallFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v1.CallFunctionRequest} CallFunctionRequest instance + */ + CallFunctionRequest.create = function create(properties) { + return new CallFunctionRequest(properties); + }; + + /** + * Encodes the specified CallFunctionRequest message. Does not implicitly {@link google.cloud.functions.v1.CallFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {google.cloud.functions.v1.ICallFunctionRequest} message CallFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CallFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.data); + return writer; + }; + + /** + * Encodes the specified CallFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.CallFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {google.cloud.functions.v1.ICallFunctionRequest} message CallFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CallFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CallFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.CallFunctionRequest} CallFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CallFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.CallFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.data = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CallFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.CallFunctionRequest} CallFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CallFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CallFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CallFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!$util.isString(message.data)) + return "data: string expected"; + return null; + }; + + /** + * Creates a CallFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.CallFunctionRequest} CallFunctionRequest + */ + CallFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.CallFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v1.CallFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.data != null) + message.data = String(object.data); + return message; + }; + + /** + * Creates a plain object from a CallFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {google.cloud.functions.v1.CallFunctionRequest} message CallFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CallFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.data = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.data != null && message.hasOwnProperty("data")) + object.data = message.data; + return object; + }; + + /** + * Converts this CallFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + CallFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CallFunctionRequest; + })(); + + v1.CallFunctionResponse = (function() { + + /** + * Properties of a CallFunctionResponse. + * @memberof google.cloud.functions.v1 + * @interface ICallFunctionResponse + * @property {string|null} [executionId] CallFunctionResponse executionId + * @property {string|null} [result] CallFunctionResponse result + * @property {string|null} [error] CallFunctionResponse error + */ + + /** + * Constructs a new CallFunctionResponse. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a CallFunctionResponse. + * @implements ICallFunctionResponse + * @constructor + * @param {google.cloud.functions.v1.ICallFunctionResponse=} [properties] Properties to set + */ + function CallFunctionResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CallFunctionResponse executionId. + * @member {string} executionId + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @instance + */ + CallFunctionResponse.prototype.executionId = ""; + + /** + * CallFunctionResponse result. + * @member {string} result + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @instance + */ + CallFunctionResponse.prototype.result = ""; + + /** + * CallFunctionResponse error. + * @member {string} error + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @instance + */ + CallFunctionResponse.prototype.error = ""; + + /** + * Creates a new CallFunctionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {google.cloud.functions.v1.ICallFunctionResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v1.CallFunctionResponse} CallFunctionResponse instance + */ + CallFunctionResponse.create = function create(properties) { + return new CallFunctionResponse(properties); + }; + + /** + * Encodes the specified CallFunctionResponse message. Does not implicitly {@link google.cloud.functions.v1.CallFunctionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {google.cloud.functions.v1.ICallFunctionResponse} message CallFunctionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CallFunctionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.executionId != null && Object.hasOwnProperty.call(message, "executionId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.executionId); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.result); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.error); + return writer; + }; + + /** + * Encodes the specified CallFunctionResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v1.CallFunctionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {google.cloud.functions.v1.ICallFunctionResponse} message CallFunctionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CallFunctionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CallFunctionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.CallFunctionResponse} CallFunctionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CallFunctionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.CallFunctionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.executionId = reader.string(); + break; + case 2: + message.result = reader.string(); + break; + case 3: + message.error = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CallFunctionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.CallFunctionResponse} CallFunctionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CallFunctionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CallFunctionResponse message. + * @function verify + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CallFunctionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.executionId != null && message.hasOwnProperty("executionId")) + if (!$util.isString(message.executionId)) + return "executionId: string expected"; + if (message.result != null && message.hasOwnProperty("result")) + if (!$util.isString(message.result)) + return "result: string expected"; + if (message.error != null && message.hasOwnProperty("error")) + if (!$util.isString(message.error)) + return "error: string expected"; + return null; + }; + + /** + * Creates a CallFunctionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.CallFunctionResponse} CallFunctionResponse + */ + CallFunctionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.CallFunctionResponse) + return object; + var message = new $root.google.cloud.functions.v1.CallFunctionResponse(); + if (object.executionId != null) + message.executionId = String(object.executionId); + if (object.result != null) + message.result = String(object.result); + if (object.error != null) + message.error = String(object.error); + return message; + }; + + /** + * Creates a plain object from a CallFunctionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {google.cloud.functions.v1.CallFunctionResponse} message CallFunctionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CallFunctionResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.executionId = ""; + object.result = ""; + object.error = ""; + } + if (message.executionId != null && message.hasOwnProperty("executionId")) + object.executionId = message.executionId; + if (message.result != null && message.hasOwnProperty("result")) + object.result = message.result; + if (message.error != null && message.hasOwnProperty("error")) + object.error = message.error; + return object; + }; + + /** + * Converts this CallFunctionResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @instance + * @returns {Object.} JSON object + */ + CallFunctionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CallFunctionResponse; + })(); + + v1.GenerateUploadUrlRequest = (function() { + + /** + * Properties of a GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v1 + * @interface IGenerateUploadUrlRequest + * @property {string|null} [parent] GenerateUploadUrlRequest parent + */ + + /** + * Constructs a new GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a GenerateUploadUrlRequest. + * @implements IGenerateUploadUrlRequest + * @constructor + * @param {google.cloud.functions.v1.IGenerateUploadUrlRequest=} [properties] Properties to set + */ + function GenerateUploadUrlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateUploadUrlRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @instance + */ + GenerateUploadUrlRequest.prototype.parent = ""; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v1.IGenerateUploadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v1.GenerateUploadUrlRequest} GenerateUploadUrlRequest instance + */ + GenerateUploadUrlRequest.create = function create(properties) { + return new GenerateUploadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v1.GenerateUploadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v1.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GenerateUploadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v1.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.GenerateUploadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.GenerateUploadUrlRequest} GenerateUploadUrlRequest + */ + GenerateUploadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.GenerateUploadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v1.GenerateUploadUrlRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v1.GenerateUploadUrlRequest} message GenerateUploadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlRequest; + })(); + + v1.GenerateUploadUrlResponse = (function() { + + /** + * Properties of a GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v1 + * @interface IGenerateUploadUrlResponse + * @property {string|null} [uploadUrl] GenerateUploadUrlResponse uploadUrl + */ + + /** + * Constructs a new GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a GenerateUploadUrlResponse. + * @implements IGenerateUploadUrlResponse + * @constructor + * @param {google.cloud.functions.v1.IGenerateUploadUrlResponse=} [properties] Properties to set + */ + function GenerateUploadUrlResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateUploadUrlResponse uploadUrl. + * @member {string} uploadUrl + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.uploadUrl = ""; + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v1.IGenerateUploadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v1.GenerateUploadUrlResponse} GenerateUploadUrlResponse instance + */ + GenerateUploadUrlResponse.create = function create(properties) { + return new GenerateUploadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v1.GenerateUploadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v1.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uploadUrl != null && Object.hasOwnProperty.call(message, "uploadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uploadUrl); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GenerateUploadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v1.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.GenerateUploadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uploadUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + if (!$util.isString(message.uploadUrl)) + return "uploadUrl: string expected"; + return null; + }; + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.GenerateUploadUrlResponse} GenerateUploadUrlResponse + */ + GenerateUploadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.GenerateUploadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v1.GenerateUploadUrlResponse(); + if (object.uploadUrl != null) + message.uploadUrl = String(object.uploadUrl); + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v1.GenerateUploadUrlResponse} message GenerateUploadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.uploadUrl = ""; + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + object.uploadUrl = message.uploadUrl; + return object; + }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlResponse; + })(); + + v1.GenerateDownloadUrlRequest = (function() { + + /** + * Properties of a GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v1 + * @interface IGenerateDownloadUrlRequest + * @property {string|null} [name] GenerateDownloadUrlRequest name + * @property {number|Long|null} [versionId] GenerateDownloadUrlRequest versionId + */ + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a GenerateDownloadUrlRequest. + * @implements IGenerateDownloadUrlRequest + * @constructor + * @param {google.cloud.functions.v1.IGenerateDownloadUrlRequest=} [properties] Properties to set + */ + function GenerateDownloadUrlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateDownloadUrlRequest name. + * @member {string} name + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @instance + */ + GenerateDownloadUrlRequest.prototype.name = ""; + + /** + * GenerateDownloadUrlRequest versionId. + * @member {number|Long} versionId + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @instance + */ + GenerateDownloadUrlRequest.prototype.versionId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v1.IGenerateDownloadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v1.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest instance + */ + GenerateDownloadUrlRequest.create = function create(properties) { + return new GenerateDownloadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v1.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v1.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.versionId != null && Object.hasOwnProperty.call(message, "versionId")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.versionId); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v1.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.GenerateDownloadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.versionId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.versionId != null && message.hasOwnProperty("versionId")) + if (!$util.isInteger(message.versionId) && !(message.versionId && $util.isInteger(message.versionId.low) && $util.isInteger(message.versionId.high))) + return "versionId: integer|Long expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + */ + GenerateDownloadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.GenerateDownloadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v1.GenerateDownloadUrlRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.versionId != null) + if ($util.Long) + (message.versionId = $util.Long.fromValue(object.versionId)).unsigned = true; + else if (typeof object.versionId === "string") + message.versionId = parseInt(object.versionId, 10); + else if (typeof object.versionId === "number") + message.versionId = object.versionId; + else if (typeof object.versionId === "object") + message.versionId = new $util.LongBits(object.versionId.low >>> 0, object.versionId.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v1.GenerateDownloadUrlRequest} message GenerateDownloadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.versionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.versionId = options.longs === String ? "0" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.versionId != null && message.hasOwnProperty("versionId")) + if (typeof message.versionId === "number") + object.versionId = options.longs === String ? String(message.versionId) : message.versionId; + else + object.versionId = options.longs === String ? $util.Long.prototype.toString.call(message.versionId) : options.longs === Number ? new $util.LongBits(message.versionId.low >>> 0, message.versionId.high >>> 0).toNumber(true) : message.versionId; + return object; + }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlRequest; + })(); + + v1.GenerateDownloadUrlResponse = (function() { + + /** + * Properties of a GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v1 + * @interface IGenerateDownloadUrlResponse + * @property {string|null} [downloadUrl] GenerateDownloadUrlResponse downloadUrl + */ + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a GenerateDownloadUrlResponse. + * @implements IGenerateDownloadUrlResponse + * @constructor + * @param {google.cloud.functions.v1.IGenerateDownloadUrlResponse=} [properties] Properties to set + */ + function GenerateDownloadUrlResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateDownloadUrlResponse downloadUrl. + * @member {string} downloadUrl + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @instance + */ + GenerateDownloadUrlResponse.prototype.downloadUrl = ""; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v1.IGenerateDownloadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v1.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse instance + */ + GenerateDownloadUrlResponse.create = function create(properties) { + return new GenerateDownloadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v1.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v1.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.downloadUrl != null && Object.hasOwnProperty.call(message, "downloadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.downloadUrl); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v1.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v1.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.GenerateDownloadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.downloadUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + if (!$util.isString(message.downloadUrl)) + return "downloadUrl: string expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + */ + GenerateDownloadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.GenerateDownloadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v1.GenerateDownloadUrlResponse(); + if (object.downloadUrl != null) + message.downloadUrl = String(object.downloadUrl); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v1.GenerateDownloadUrlResponse} message GenerateDownloadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.downloadUrl = ""; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + object.downloadUrl = message.downloadUrl; + return object; + }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlResponse; + })(); + + /** + * OperationType enum. + * @name google.cloud.functions.v1.OperationType + * @enum {number} + * @property {number} OPERATION_UNSPECIFIED=0 OPERATION_UNSPECIFIED value + * @property {number} CREATE_FUNCTION=1 CREATE_FUNCTION value + * @property {number} UPDATE_FUNCTION=2 UPDATE_FUNCTION value + * @property {number} DELETE_FUNCTION=3 DELETE_FUNCTION value + */ + v1.OperationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATE_FUNCTION"] = 1; + values[valuesById[2] = "UPDATE_FUNCTION"] = 2; + values[valuesById[3] = "DELETE_FUNCTION"] = 3; + return values; + })(); + + v1.OperationMetadataV1 = (function() { + + /** + * Properties of an OperationMetadataV1. + * @memberof google.cloud.functions.v1 + * @interface IOperationMetadataV1 + * @property {string|null} [target] OperationMetadataV1 target + * @property {google.cloud.functions.v1.OperationType|null} [type] OperationMetadataV1 type + * @property {google.protobuf.IAny|null} [request] OperationMetadataV1 request + * @property {number|Long|null} [versionId] OperationMetadataV1 versionId + * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadataV1 updateTime + * @property {string|null} [buildId] OperationMetadataV1 buildId + */ + + /** + * Constructs a new OperationMetadataV1. + * @memberof google.cloud.functions.v1 + * @classdesc Represents an OperationMetadataV1. + * @implements IOperationMetadataV1 + * @constructor + * @param {google.cloud.functions.v1.IOperationMetadataV1=} [properties] Properties to set + */ + function OperationMetadataV1(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationMetadataV1 target. + * @member {string} target + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + */ + OperationMetadataV1.prototype.target = ""; + + /** + * OperationMetadataV1 type. + * @member {google.cloud.functions.v1.OperationType} type + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + */ + OperationMetadataV1.prototype.type = 0; + + /** + * OperationMetadataV1 request. + * @member {google.protobuf.IAny|null|undefined} request + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + */ + OperationMetadataV1.prototype.request = null; + + /** + * OperationMetadataV1 versionId. + * @member {number|Long} versionId + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + */ + OperationMetadataV1.prototype.versionId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * OperationMetadataV1 updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + */ + OperationMetadataV1.prototype.updateTime = null; + + /** + * OperationMetadataV1 buildId. + * @member {string} buildId + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + */ + OperationMetadataV1.prototype.buildId = ""; + + /** + * Creates a new OperationMetadataV1 instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {google.cloud.functions.v1.IOperationMetadataV1=} [properties] Properties to set + * @returns {google.cloud.functions.v1.OperationMetadataV1} OperationMetadataV1 instance + */ + OperationMetadataV1.create = function create(properties) { + return new OperationMetadataV1(properties); + }; + + /** + * Encodes the specified OperationMetadataV1 message. Does not implicitly {@link google.cloud.functions.v1.OperationMetadataV1.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {google.cloud.functions.v1.IOperationMetadataV1} message OperationMetadataV1 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadataV1.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.target); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.request != null && Object.hasOwnProperty.call(message, "request")) + $root.google.protobuf.Any.encode(message.request, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.versionId != null && Object.hasOwnProperty.call(message, "versionId")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.versionId); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.buildId != null && Object.hasOwnProperty.call(message, "buildId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.buildId); + return writer; + }; + + /** + * Encodes the specified OperationMetadataV1 message, length delimited. Does not implicitly {@link google.cloud.functions.v1.OperationMetadataV1.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {google.cloud.functions.v1.IOperationMetadataV1} message OperationMetadataV1 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadataV1.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadataV1 message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.OperationMetadataV1} OperationMetadataV1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadataV1.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.OperationMetadataV1(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.target = reader.string(); + break; + case 2: + message.type = reader.int32(); + break; + case 3: + message.request = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 4: + message.versionId = reader.int64(); + break; + case 5: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.buildId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadataV1 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.OperationMetadataV1} OperationMetadataV1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadataV1.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadataV1 message. + * @function verify + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadataV1.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.request != null && message.hasOwnProperty("request")) { + var error = $root.google.protobuf.Any.verify(message.request); + if (error) + return "request." + error; + } + if (message.versionId != null && message.hasOwnProperty("versionId")) + if (!$util.isInteger(message.versionId) && !(message.versionId && $util.isInteger(message.versionId.low) && $util.isInteger(message.versionId.high))) + return "versionId: integer|Long expected"; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.buildId != null && message.hasOwnProperty("buildId")) + if (!$util.isString(message.buildId)) + return "buildId: string expected"; + return null; + }; + + /** + * Creates an OperationMetadataV1 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.OperationMetadataV1} OperationMetadataV1 + */ + OperationMetadataV1.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.OperationMetadataV1) + return object; + var message = new $root.google.cloud.functions.v1.OperationMetadataV1(); + if (object.target != null) + message.target = String(object.target); + switch (object.type) { + case "OPERATION_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "CREATE_FUNCTION": + case 1: + message.type = 1; + break; + case "UPDATE_FUNCTION": + case 2: + message.type = 2; + break; + case "DELETE_FUNCTION": + case 3: + message.type = 3; + break; + } + if (object.request != null) { + if (typeof object.request !== "object") + throw TypeError(".google.cloud.functions.v1.OperationMetadataV1.request: object expected"); + message.request = $root.google.protobuf.Any.fromObject(object.request); + } + if (object.versionId != null) + if ($util.Long) + (message.versionId = $util.Long.fromValue(object.versionId)).unsigned = false; + else if (typeof object.versionId === "string") + message.versionId = parseInt(object.versionId, 10); + else if (typeof object.versionId === "number") + message.versionId = object.versionId; + else if (typeof object.versionId === "object") + message.versionId = new $util.LongBits(object.versionId.low >>> 0, object.versionId.high >>> 0).toNumber(); + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.functions.v1.OperationMetadataV1.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.buildId != null) + message.buildId = String(object.buildId); + return message; + }; + + /** + * Creates a plain object from an OperationMetadataV1 message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {google.cloud.functions.v1.OperationMetadataV1} message OperationMetadataV1 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadataV1.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.target = ""; + object.type = options.enums === String ? "OPERATION_UNSPECIFIED" : 0; + object.request = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.versionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.versionId = options.longs === String ? "0" : 0; + object.updateTime = null; + object.buildId = ""; + } + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.functions.v1.OperationType[message.type] : message.type; + if (message.request != null && message.hasOwnProperty("request")) + object.request = $root.google.protobuf.Any.toObject(message.request, options); + if (message.versionId != null && message.hasOwnProperty("versionId")) + if (typeof message.versionId === "number") + object.versionId = options.longs === String ? String(message.versionId) : message.versionId; + else + object.versionId = options.longs === String ? $util.Long.prototype.toString.call(message.versionId) : options.longs === Number ? new $util.LongBits(message.versionId.low >>> 0, message.versionId.high >>> 0).toNumber() : message.versionId; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.buildId != null && message.hasOwnProperty("buildId")) + object.buildId = message.buildId; + return object; + }; + + /** + * Converts this OperationMetadataV1 to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + * @returns {Object.} JSON object + */ + OperationMetadataV1.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationMetadataV1; + })(); + + return v1; + })(); + + return functions; + })(); + + return cloud; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + case 2: + message.fullyDecodeReservedExpansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = ""; + + /** + * HttpRule put. + * @member {string} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = ""; + + /** + * HttpRule post. + * @member {string} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = ""; + + /** + * HttpRule delete. + * @member {string} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = ""; + + /** + * HttpRule patch. + * @member {string} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = ""; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selector = reader.string(); + break; + case 2: + message.get = reader.string(); + break; + case 3: + message.put = reader.string(); + break; + case 4: + message.post = reader.string(); + break; + case 5: + message["delete"] = reader.string(); + break; + case 6: + message.patch = reader.string(); + break; + case 8: + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 7: + message.body = reader.string(); + break; + case 12: + message.responseBody = reader.string(); + break; + case 11: + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.kind = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomHttpPattern; + })(); + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + case 3: + message.nameField = reader.string(); + break; + case 4: + message.history = reader.int32(); + break; + case 5: + message.plural = reader.string(); + break; + case 6: + message.singular = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pattern = []; + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.childType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResourceReference; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorSet; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message["package"] = reader.string(); + break; + case 3: + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + case 10: + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + case 11: + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + case 4: + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 8: + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + case 3: + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.number = reader.int32(); + break; + case 4: + message.label = reader.int32(); + break; + case 5: + message.type = reader.int32(); + break; + case 6: + message.typeName = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.defaultValue = reader.string(); + break; + case 9: + message.oneofIndex = reader.int32(); + break; + case 10: + message.jsonName = reader.string(); + break; + case 8: + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + case 17: + message.proto3Optional = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + } + switch (object.type) { + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.number = reader.int32(); + break; + case 3: + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.inputType = reader.string(); + break; + case 3: + message.outputType = reader.string(); + break; + case 4: + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [phpGenericServices] FileOptions phpGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions phpGenericServices. + * @member {boolean} phpGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) + writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.javaPackage = reader.string(); + break; + case 8: + message.javaOuterClassname = reader.string(); + break; + case 10: + message.javaMultipleFiles = reader.bool(); + break; + case 20: + message.javaGenerateEqualsAndHash = reader.bool(); + break; + case 27: + message.javaStringCheckUtf8 = reader.bool(); + break; + case 9: + message.optimizeFor = reader.int32(); + break; + case 11: + message.goPackage = reader.string(); + break; + case 16: + message.ccGenericServices = reader.bool(); + break; + case 17: + message.javaGenericServices = reader.bool(); + break; + case 18: + message.pyGenericServices = reader.bool(); + break; + case 42: + message.phpGenericServices = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.ccEnableArenas = reader.bool(); + break; + case 36: + message.objcClassPrefix = reader.string(); + break; + case 37: + message.csharpNamespace = reader.string(); + break; + case 39: + message.swiftPrefix = reader.string(); + break; + case 40: + message.phpClassPrefix = reader.string(); + break; + case 41: + message.phpNamespace = reader.string(); + break; + case 44: + message.phpMetadataNamespace = reader.string(); + break; + case 45: + message.rubyPackage = reader.string(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1053: + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + if (typeof message.phpGenericServices !== "boolean") + return "phpGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.phpGenericServices != null) + message.phpGenericServices = Boolean(object.phpGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = true; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpGenericServices = false; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + object.phpGenericServices = message.phpGenericServices; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageSetWireFormat = reader.bool(); + break; + case 2: + message.noStandardDescriptorAccessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.mapEntry = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1053: + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) { + writer.uint32(/* id 1052, wireType 2 =*/8418).fork(); + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.int32(message[".google.api.fieldBehavior"][i]); + writer.ldelim(); + } + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = reader.int32(); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = reader.int32(); + break; + case 5: + message.lazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1052: + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + case 1055: + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + } + } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object[".google.api.resourceReference"] = null; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allowAlias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1049: + message[".google.api.defaultHost"] = reader.string(); + break; + case 1050: + message[".google.api.oauthScopes"] = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + * @property {google.longrunning.IOperationInfo|null} [".google.longrunning.operationInfo"] MethodOptions .google.longrunning.operationInfo + */ + + /** + * Constructs a new MethodOptions. + * @memberof google.protobuf + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions + * @constructor + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + */ + function MethodOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.methodSignature"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.deprecated = false; + + /** + * MethodOptions idempotencyLevel. + * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.idempotencyLevel = 0; + + /** + * MethodOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {google.api.IHttpRule|null|undefined} .google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * MethodOptions .google.api.methodSignature. + * @member {Array.} .google.api.methodSignature + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + + /** + * MethodOptions .google.longrunning.operationInfo. + * @member {google.longrunning.IOperationInfo|null|undefined} .google.longrunning.operationInfo + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.longrunning.operationInfo"] = null; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance + */ + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); + }; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) + $root.google.longrunning.OperationInfo.encode(message[".google.longrunning.operationInfo"], writer.uint32(/* id 1049, wireType 2 =*/8394).fork()).ldelim(); + if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 34: + message.idempotencyLevel = reader.int32(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 72295728: + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + case 1051: + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + case 1049: + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + switch (message.idempotencyLevel) { + default: + return "idempotencyLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + if (error) + return ".google.api.http." + error; + } + if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { + if (!Array.isArray(message[".google.api.methodSignature"])) + return ".google.api.methodSignature: array expected"; + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + if (!$util.isString(message[".google.api.methodSignature"][i])) + return ".google.api.methodSignature: string[] expected"; + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) { + var error = $root.google.longrunning.OperationInfo.verify(message[".google.longrunning.operationInfo"]); + if (error) + return ".google.longrunning.operationInfo." + error; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + switch (object.idempotencyLevel) { + case "IDEMPOTENCY_UNKNOWN": + case 0: + message.idempotencyLevel = 0; + break; + case "NO_SIDE_EFFECTS": + case 1: + message.idempotencyLevel = 1; + break; + case "IDEMPOTENT": + case 2: + message.idempotencyLevel = 2; + break; + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + if (object[".google.api.methodSignature"]) { + if (!Array.isArray(object[".google.api.methodSignature"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); + message[".google.api.methodSignature"] = []; + for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) + message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); + } + if (object[".google.longrunning.operationInfo"] != null) { + if (typeof object[".google.longrunning.operationInfo"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.longrunning.operationInfo: object expected"); + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.fromObject(object[".google.longrunning.operationInfo"]); + } + return message; + }; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.methodSignature"] = []; + } + if (options.defaults) { + object.deprecated = false; + object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; + object[".google.longrunning.operationInfo"] = null; + object[".google.api.http"] = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) + object[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.toObject(message[".google.longrunning.operationInfo"], options); + if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { + object[".google.api.methodSignature"] = []; + for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) + object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * IdempotencyLevel enum. + * @name google.protobuf.MethodOptions.IdempotencyLevel + * @enum {number} + * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value + * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value + * @property {number} IDEMPOTENT=2 IDEMPOTENT value + */ + MethodOptions.IdempotencyLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; + values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; + values[valuesById[2] = "IDEMPOTENT"] = 2; + return values; + })(); + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number|null} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue + * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifierValue = ""; + + /** + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negativeIntValue. + * @member {number|Long} negativeIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption doubleValue. + * @member {number} doubleValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.doubleValue = 0; + + /** + * UninterpretedOption stringValue. + * @member {Uint8Array} stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + + /** + * UninterpretedOption aggregateValue. + * @member {string} aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + case 3: + message.identifierValue = reader.string(); + break; + case 4: + message.positiveIntValue = reader.uint64(); + break; + case 5: + message.negativeIntValue = reader.int64(); + break; + case 6: + message.doubleValue = reader.double(); + break; + case 7: + message.stringValue = reader.bytes(); + break; + case 8: + message.aggregateValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : 0; + object.doubleValue = 0; + if (options.bytes === String) + object.stringValue = ""; + else { + object.stringValue = []; + if (options.bytes !== Array) + object.stringValue = $util.newBuffer(object.stringValue); + } + object.aggregateValue = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + object.aggregateValue = message.aggregateValue; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namePart = reader.string(); + break; + case 2: + message.isExtension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!message.hasOwnProperty("isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + */ + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); + }; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + case 3: + message.leadingComments = reader.string(); + break; + case 4: + message.trailingComments = reader.string(); + break; + case 6: + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + */ + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); + }; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [sourceFile] Annotation sourceFile + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation sourceFile. + * @member {string} sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; + + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + message.sourceFile = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance + */ + Any.create = function create(properties) { + return new Any(properties); + }; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type_url = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any + * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Any; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Duration; + })(); + + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Empty; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FieldMask; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @implements ITimestamp + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. + * @function create + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance + */ + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Timestamp; + })(); + + return protobuf; + })(); + + google.iam = (function() { + + /** + * Namespace iam. + * @memberof google + * @namespace + */ + var iam = {}; + + iam.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.iam + * @namespace + */ + var v1 = {}; + + v1.IAMPolicy = (function() { + + /** + * Constructs a new IAMPolicy service. + * @memberof google.iam.v1 + * @classdesc Represents a IAMPolicy + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function IAMPolicy(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (IAMPolicy.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = IAMPolicy; + + /** + * Creates new IAMPolicy service using the specified rpc implementation. + * @function create + * @memberof google.iam.v1.IAMPolicy + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {IAMPolicy} RPC service. Useful where requests and/or responses are streamed. + */ + IAMPolicy.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * @memberof google.iam.v1.IAMPolicy + * @typedef SetIamPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.Policy} [response] Policy + */ + + /** + * Calls SetIamPolicy. + * @function setIamPolicy + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.ISetIamPolicyRequest} request SetIamPolicyRequest message or plain object + * @param {google.iam.v1.IAMPolicy.SetIamPolicyCallback} callback Node-style callback called with the error, if any, and Policy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IAMPolicy.prototype.setIamPolicy = function setIamPolicy(request, callback) { + return this.rpcCall(setIamPolicy, $root.google.iam.v1.SetIamPolicyRequest, $root.google.iam.v1.Policy, request, callback); + }, "name", { value: "SetIamPolicy" }); + + /** + * Calls SetIamPolicy. + * @function setIamPolicy + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.ISetIamPolicyRequest} request SetIamPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * @memberof google.iam.v1.IAMPolicy + * @typedef GetIamPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.Policy} [response] Policy + */ + + /** + * Calls GetIamPolicy. + * @function getIamPolicy + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.IGetIamPolicyRequest} request GetIamPolicyRequest message or plain object + * @param {google.iam.v1.IAMPolicy.GetIamPolicyCallback} callback Node-style callback called with the error, if any, and Policy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IAMPolicy.prototype.getIamPolicy = function getIamPolicy(request, callback) { + return this.rpcCall(getIamPolicy, $root.google.iam.v1.GetIamPolicyRequest, $root.google.iam.v1.Policy, request, callback); + }, "name", { value: "GetIamPolicy" }); + + /** + * Calls GetIamPolicy. + * @function getIamPolicy + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.IGetIamPolicyRequest} request GetIamPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * @memberof google.iam.v1.IAMPolicy + * @typedef TestIamPermissionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.TestIamPermissionsResponse} [response] TestIamPermissionsResponse + */ + + /** + * Calls TestIamPermissions. + * @function testIamPermissions + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.ITestIamPermissionsRequest} request TestIamPermissionsRequest message or plain object + * @param {google.iam.v1.IAMPolicy.TestIamPermissionsCallback} callback Node-style callback called with the error, if any, and TestIamPermissionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IAMPolicy.prototype.testIamPermissions = function testIamPermissions(request, callback) { + return this.rpcCall(testIamPermissions, $root.google.iam.v1.TestIamPermissionsRequest, $root.google.iam.v1.TestIamPermissionsResponse, request, callback); + }, "name", { value: "TestIamPermissions" }); + + /** + * Calls TestIamPermissions. + * @function testIamPermissions + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.ITestIamPermissionsRequest} request TestIamPermissionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return IAMPolicy; + })(); + + v1.SetIamPolicyRequest = (function() { + + /** + * Properties of a SetIamPolicyRequest. + * @memberof google.iam.v1 + * @interface ISetIamPolicyRequest + * @property {string|null} [resource] SetIamPolicyRequest resource + * @property {google.iam.v1.IPolicy|null} [policy] SetIamPolicyRequest policy + */ + + /** + * Constructs a new SetIamPolicyRequest. + * @memberof google.iam.v1 + * @classdesc Represents a SetIamPolicyRequest. + * @implements ISetIamPolicyRequest + * @constructor + * @param {google.iam.v1.ISetIamPolicyRequest=} [properties] Properties to set + */ + function SetIamPolicyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetIamPolicyRequest resource. + * @member {string} resource + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + */ + SetIamPolicyRequest.prototype.resource = ""; + + /** + * SetIamPolicyRequest policy. + * @member {google.iam.v1.IPolicy|null|undefined} policy + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + */ + SetIamPolicyRequest.prototype.policy = null; + + /** + * Creates a new SetIamPolicyRequest instance using the specified properties. + * @function create + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {google.iam.v1.ISetIamPolicyRequest=} [properties] Properties to set + * @returns {google.iam.v1.SetIamPolicyRequest} SetIamPolicyRequest instance + */ + SetIamPolicyRequest.create = function create(properties) { + return new SetIamPolicyRequest(properties); + }; + + /** + * Encodes the specified SetIamPolicyRequest message. Does not implicitly {@link google.iam.v1.SetIamPolicyRequest.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {google.iam.v1.ISetIamPolicyRequest} message SetIamPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetIamPolicyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); + if (message.policy != null && Object.hasOwnProperty.call(message, "policy")) + $root.google.iam.v1.Policy.encode(message.policy, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetIamPolicyRequest message, length delimited. Does not implicitly {@link google.iam.v1.SetIamPolicyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {google.iam.v1.ISetIamPolicyRequest} message SetIamPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetIamPolicyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetIamPolicyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.SetIamPolicyRequest} SetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetIamPolicyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.SetIamPolicyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resource = reader.string(); + break; + case 2: + message.policy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetIamPolicyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.SetIamPolicyRequest} SetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetIamPolicyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetIamPolicyRequest message. + * @function verify + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetIamPolicyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.policy != null && message.hasOwnProperty("policy")) { + var error = $root.google.iam.v1.Policy.verify(message.policy); + if (error) + return "policy." + error; + } + return null; + }; + + /** + * Creates a SetIamPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.SetIamPolicyRequest} SetIamPolicyRequest + */ + SetIamPolicyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.SetIamPolicyRequest) + return object; + var message = new $root.google.iam.v1.SetIamPolicyRequest(); + if (object.resource != null) + message.resource = String(object.resource); + if (object.policy != null) { + if (typeof object.policy !== "object") + throw TypeError(".google.iam.v1.SetIamPolicyRequest.policy: object expected"); + message.policy = $root.google.iam.v1.Policy.fromObject(object.policy); + } + return message; + }; + + /** + * Creates a plain object from a SetIamPolicyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {google.iam.v1.SetIamPolicyRequest} message SetIamPolicyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetIamPolicyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resource = ""; + object.policy = null; + } + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.policy != null && message.hasOwnProperty("policy")) + object.policy = $root.google.iam.v1.Policy.toObject(message.policy, options); + return object; + }; + + /** + * Converts this SetIamPolicyRequest to JSON. + * @function toJSON + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + * @returns {Object.} JSON object + */ + SetIamPolicyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetIamPolicyRequest; + })(); + + v1.GetIamPolicyRequest = (function() { + + /** + * Properties of a GetIamPolicyRequest. + * @memberof google.iam.v1 + * @interface IGetIamPolicyRequest + * @property {string|null} [resource] GetIamPolicyRequest resource + * @property {google.iam.v1.IGetPolicyOptions|null} [options] GetIamPolicyRequest options + */ + + /** + * Constructs a new GetIamPolicyRequest. + * @memberof google.iam.v1 + * @classdesc Represents a GetIamPolicyRequest. + * @implements IGetIamPolicyRequest + * @constructor + * @param {google.iam.v1.IGetIamPolicyRequest=} [properties] Properties to set + */ + function GetIamPolicyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIamPolicyRequest resource. + * @member {string} resource + * @memberof google.iam.v1.GetIamPolicyRequest + * @instance + */ + GetIamPolicyRequest.prototype.resource = ""; + + /** + * GetIamPolicyRequest options. + * @member {google.iam.v1.IGetPolicyOptions|null|undefined} options + * @memberof google.iam.v1.GetIamPolicyRequest + * @instance + */ + GetIamPolicyRequest.prototype.options = null; + + /** + * Creates a new GetIamPolicyRequest instance using the specified properties. + * @function create + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {google.iam.v1.IGetIamPolicyRequest=} [properties] Properties to set + * @returns {google.iam.v1.GetIamPolicyRequest} GetIamPolicyRequest instance + */ + GetIamPolicyRequest.create = function create(properties) { + return new GetIamPolicyRequest(properties); + }; + + /** + * Encodes the specified GetIamPolicyRequest message. Does not implicitly {@link google.iam.v1.GetIamPolicyRequest.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {google.iam.v1.IGetIamPolicyRequest} message GetIamPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIamPolicyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.iam.v1.GetPolicyOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIamPolicyRequest message, length delimited. Does not implicitly {@link google.iam.v1.GetIamPolicyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {google.iam.v1.IGetIamPolicyRequest} message GetIamPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIamPolicyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIamPolicyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.GetIamPolicyRequest} GetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIamPolicyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.GetIamPolicyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resource = reader.string(); + break; + case 2: + message.options = $root.google.iam.v1.GetPolicyOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIamPolicyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.GetIamPolicyRequest} GetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIamPolicyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIamPolicyRequest message. + * @function verify + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIamPolicyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.iam.v1.GetPolicyOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a GetIamPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.GetIamPolicyRequest} GetIamPolicyRequest + */ + GetIamPolicyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.GetIamPolicyRequest) + return object; + var message = new $root.google.iam.v1.GetIamPolicyRequest(); + if (object.resource != null) + message.resource = String(object.resource); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.iam.v1.GetIamPolicyRequest.options: object expected"); + message.options = $root.google.iam.v1.GetPolicyOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a GetIamPolicyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {google.iam.v1.GetIamPolicyRequest} message GetIamPolicyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIamPolicyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resource = ""; + object.options = null; + } + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.iam.v1.GetPolicyOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this GetIamPolicyRequest to JSON. + * @function toJSON + * @memberof google.iam.v1.GetIamPolicyRequest + * @instance + * @returns {Object.} JSON object + */ + GetIamPolicyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetIamPolicyRequest; + })(); + + v1.TestIamPermissionsRequest = (function() { + + /** + * Properties of a TestIamPermissionsRequest. + * @memberof google.iam.v1 + * @interface ITestIamPermissionsRequest + * @property {string|null} [resource] TestIamPermissionsRequest resource + * @property {Array.|null} [permissions] TestIamPermissionsRequest permissions + */ + + /** + * Constructs a new TestIamPermissionsRequest. + * @memberof google.iam.v1 + * @classdesc Represents a TestIamPermissionsRequest. + * @implements ITestIamPermissionsRequest + * @constructor + * @param {google.iam.v1.ITestIamPermissionsRequest=} [properties] Properties to set + */ + function TestIamPermissionsRequest(properties) { + this.permissions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TestIamPermissionsRequest resource. + * @member {string} resource + * @memberof google.iam.v1.TestIamPermissionsRequest + * @instance + */ + TestIamPermissionsRequest.prototype.resource = ""; + + /** + * TestIamPermissionsRequest permissions. + * @member {Array.} permissions + * @memberof google.iam.v1.TestIamPermissionsRequest + * @instance + */ + TestIamPermissionsRequest.prototype.permissions = $util.emptyArray; + + /** + * Creates a new TestIamPermissionsRequest instance using the specified properties. + * @function create + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {google.iam.v1.ITestIamPermissionsRequest=} [properties] Properties to set + * @returns {google.iam.v1.TestIamPermissionsRequest} TestIamPermissionsRequest instance + */ + TestIamPermissionsRequest.create = function create(properties) { + return new TestIamPermissionsRequest(properties); + }; + + /** + * Encodes the specified TestIamPermissionsRequest message. Does not implicitly {@link google.iam.v1.TestIamPermissionsRequest.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {google.iam.v1.ITestIamPermissionsRequest} message TestIamPermissionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestIamPermissionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); + if (message.permissions != null && message.permissions.length) + for (var i = 0; i < message.permissions.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.permissions[i]); + return writer; + }; + + /** + * Encodes the specified TestIamPermissionsRequest message, length delimited. Does not implicitly {@link google.iam.v1.TestIamPermissionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {google.iam.v1.ITestIamPermissionsRequest} message TestIamPermissionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestIamPermissionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TestIamPermissionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.TestIamPermissionsRequest} TestIamPermissionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestIamPermissionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.TestIamPermissionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resource = reader.string(); + break; + case 2: + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TestIamPermissionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.TestIamPermissionsRequest} TestIamPermissionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestIamPermissionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TestIamPermissionsRequest message. + * @function verify + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TestIamPermissionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.permissions != null && message.hasOwnProperty("permissions")) { + if (!Array.isArray(message.permissions)) + return "permissions: array expected"; + for (var i = 0; i < message.permissions.length; ++i) + if (!$util.isString(message.permissions[i])) + return "permissions: string[] expected"; + } + return null; + }; + + /** + * Creates a TestIamPermissionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.TestIamPermissionsRequest} TestIamPermissionsRequest + */ + TestIamPermissionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.TestIamPermissionsRequest) + return object; + var message = new $root.google.iam.v1.TestIamPermissionsRequest(); + if (object.resource != null) + message.resource = String(object.resource); + if (object.permissions) { + if (!Array.isArray(object.permissions)) + throw TypeError(".google.iam.v1.TestIamPermissionsRequest.permissions: array expected"); + message.permissions = []; + for (var i = 0; i < object.permissions.length; ++i) + message.permissions[i] = String(object.permissions[i]); + } + return message; + }; + + /** + * Creates a plain object from a TestIamPermissionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {google.iam.v1.TestIamPermissionsRequest} message TestIamPermissionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TestIamPermissionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.permissions = []; + if (options.defaults) + object.resource = ""; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.permissions && message.permissions.length) { + object.permissions = []; + for (var j = 0; j < message.permissions.length; ++j) + object.permissions[j] = message.permissions[j]; + } + return object; + }; + + /** + * Converts this TestIamPermissionsRequest to JSON. + * @function toJSON + * @memberof google.iam.v1.TestIamPermissionsRequest + * @instance + * @returns {Object.} JSON object + */ + TestIamPermissionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TestIamPermissionsRequest; + })(); + + v1.TestIamPermissionsResponse = (function() { + + /** + * Properties of a TestIamPermissionsResponse. + * @memberof google.iam.v1 + * @interface ITestIamPermissionsResponse + * @property {Array.|null} [permissions] TestIamPermissionsResponse permissions + */ + + /** + * Constructs a new TestIamPermissionsResponse. + * @memberof google.iam.v1 + * @classdesc Represents a TestIamPermissionsResponse. + * @implements ITestIamPermissionsResponse + * @constructor + * @param {google.iam.v1.ITestIamPermissionsResponse=} [properties] Properties to set + */ + function TestIamPermissionsResponse(properties) { + this.permissions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TestIamPermissionsResponse permissions. + * @member {Array.} permissions + * @memberof google.iam.v1.TestIamPermissionsResponse + * @instance + */ + TestIamPermissionsResponse.prototype.permissions = $util.emptyArray; + + /** + * Creates a new TestIamPermissionsResponse instance using the specified properties. + * @function create + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {google.iam.v1.ITestIamPermissionsResponse=} [properties] Properties to set + * @returns {google.iam.v1.TestIamPermissionsResponse} TestIamPermissionsResponse instance + */ + TestIamPermissionsResponse.create = function create(properties) { + return new TestIamPermissionsResponse(properties); + }; + + /** + * Encodes the specified TestIamPermissionsResponse message. Does not implicitly {@link google.iam.v1.TestIamPermissionsResponse.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {google.iam.v1.ITestIamPermissionsResponse} message TestIamPermissionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestIamPermissionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.permissions != null && message.permissions.length) + for (var i = 0; i < message.permissions.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.permissions[i]); + return writer; + }; + + /** + * Encodes the specified TestIamPermissionsResponse message, length delimited. Does not implicitly {@link google.iam.v1.TestIamPermissionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {google.iam.v1.ITestIamPermissionsResponse} message TestIamPermissionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestIamPermissionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TestIamPermissionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.TestIamPermissionsResponse} TestIamPermissionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestIamPermissionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.TestIamPermissionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TestIamPermissionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.TestIamPermissionsResponse} TestIamPermissionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestIamPermissionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TestIamPermissionsResponse message. + * @function verify + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TestIamPermissionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.permissions != null && message.hasOwnProperty("permissions")) { + if (!Array.isArray(message.permissions)) + return "permissions: array expected"; + for (var i = 0; i < message.permissions.length; ++i) + if (!$util.isString(message.permissions[i])) + return "permissions: string[] expected"; + } + return null; + }; + + /** + * Creates a TestIamPermissionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.TestIamPermissionsResponse} TestIamPermissionsResponse + */ + TestIamPermissionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.TestIamPermissionsResponse) + return object; + var message = new $root.google.iam.v1.TestIamPermissionsResponse(); + if (object.permissions) { + if (!Array.isArray(object.permissions)) + throw TypeError(".google.iam.v1.TestIamPermissionsResponse.permissions: array expected"); + message.permissions = []; + for (var i = 0; i < object.permissions.length; ++i) + message.permissions[i] = String(object.permissions[i]); + } + return message; + }; + + /** + * Creates a plain object from a TestIamPermissionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {google.iam.v1.TestIamPermissionsResponse} message TestIamPermissionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TestIamPermissionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.permissions = []; + if (message.permissions && message.permissions.length) { + object.permissions = []; + for (var j = 0; j < message.permissions.length; ++j) + object.permissions[j] = message.permissions[j]; + } + return object; + }; + + /** + * Converts this TestIamPermissionsResponse to JSON. + * @function toJSON + * @memberof google.iam.v1.TestIamPermissionsResponse + * @instance + * @returns {Object.} JSON object + */ + TestIamPermissionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TestIamPermissionsResponse; + })(); + + v1.GetPolicyOptions = (function() { + + /** + * Properties of a GetPolicyOptions. + * @memberof google.iam.v1 + * @interface IGetPolicyOptions + * @property {number|null} [requestedPolicyVersion] GetPolicyOptions requestedPolicyVersion + */ + + /** + * Constructs a new GetPolicyOptions. + * @memberof google.iam.v1 + * @classdesc Represents a GetPolicyOptions. + * @implements IGetPolicyOptions + * @constructor + * @param {google.iam.v1.IGetPolicyOptions=} [properties] Properties to set + */ + function GetPolicyOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetPolicyOptions requestedPolicyVersion. + * @member {number} requestedPolicyVersion + * @memberof google.iam.v1.GetPolicyOptions + * @instance + */ + GetPolicyOptions.prototype.requestedPolicyVersion = 0; + + /** + * Creates a new GetPolicyOptions instance using the specified properties. + * @function create + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {google.iam.v1.IGetPolicyOptions=} [properties] Properties to set + * @returns {google.iam.v1.GetPolicyOptions} GetPolicyOptions instance + */ + GetPolicyOptions.create = function create(properties) { + return new GetPolicyOptions(properties); + }; + + /** + * Encodes the specified GetPolicyOptions message. Does not implicitly {@link google.iam.v1.GetPolicyOptions.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {google.iam.v1.IGetPolicyOptions} message GetPolicyOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPolicyOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.requestedPolicyVersion != null && Object.hasOwnProperty.call(message, "requestedPolicyVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.requestedPolicyVersion); + return writer; + }; + + /** + * Encodes the specified GetPolicyOptions message, length delimited. Does not implicitly {@link google.iam.v1.GetPolicyOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {google.iam.v1.IGetPolicyOptions} message GetPolicyOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPolicyOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetPolicyOptions message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.GetPolicyOptions} GetPolicyOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPolicyOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.GetPolicyOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.requestedPolicyVersion = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetPolicyOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.GetPolicyOptions} GetPolicyOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPolicyOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetPolicyOptions message. + * @function verify + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetPolicyOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.requestedPolicyVersion != null && message.hasOwnProperty("requestedPolicyVersion")) + if (!$util.isInteger(message.requestedPolicyVersion)) + return "requestedPolicyVersion: integer expected"; + return null; + }; + + /** + * Creates a GetPolicyOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.GetPolicyOptions} GetPolicyOptions + */ + GetPolicyOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.GetPolicyOptions) + return object; + var message = new $root.google.iam.v1.GetPolicyOptions(); + if (object.requestedPolicyVersion != null) + message.requestedPolicyVersion = object.requestedPolicyVersion | 0; + return message; + }; + + /** + * Creates a plain object from a GetPolicyOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {google.iam.v1.GetPolicyOptions} message GetPolicyOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetPolicyOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.requestedPolicyVersion = 0; + if (message.requestedPolicyVersion != null && message.hasOwnProperty("requestedPolicyVersion")) + object.requestedPolicyVersion = message.requestedPolicyVersion; + return object; + }; + + /** + * Converts this GetPolicyOptions to JSON. + * @function toJSON + * @memberof google.iam.v1.GetPolicyOptions + * @instance + * @returns {Object.} JSON object + */ + GetPolicyOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetPolicyOptions; + })(); + + v1.Policy = (function() { + + /** + * Properties of a Policy. + * @memberof google.iam.v1 + * @interface IPolicy + * @property {number|null} [version] Policy version + * @property {Array.|null} [bindings] Policy bindings + * @property {Uint8Array|null} [etag] Policy etag + */ + + /** + * Constructs a new Policy. + * @memberof google.iam.v1 + * @classdesc Represents a Policy. + * @implements IPolicy + * @constructor + * @param {google.iam.v1.IPolicy=} [properties] Properties to set + */ + function Policy(properties) { + this.bindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Policy version. + * @member {number} version + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.version = 0; + + /** + * Policy bindings. + * @member {Array.} bindings + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.bindings = $util.emptyArray; + + /** + * Policy etag. + * @member {Uint8Array} etag + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.etag = $util.newBuffer([]); + + /** + * Creates a new Policy instance using the specified properties. + * @function create + * @memberof google.iam.v1.Policy + * @static + * @param {google.iam.v1.IPolicy=} [properties] Properties to set + * @returns {google.iam.v1.Policy} Policy instance + */ + Policy.create = function create(properties) { + return new Policy(properties); + }; + + /** + * Encodes the specified Policy message. Does not implicitly {@link google.iam.v1.Policy.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.Policy + * @static + * @param {google.iam.v1.IPolicy} message Policy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Policy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.version); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.etag); + if (message.bindings != null && message.bindings.length) + for (var i = 0; i < message.bindings.length; ++i) + $root.google.iam.v1.Binding.encode(message.bindings[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Policy message, length delimited. Does not implicitly {@link google.iam.v1.Policy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.Policy + * @static + * @param {google.iam.v1.IPolicy} message Policy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Policy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Policy message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.Policy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.Policy} Policy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Policy.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.Policy(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.int32(); + break; + case 4: + if (!(message.bindings && message.bindings.length)) + message.bindings = []; + message.bindings.push($root.google.iam.v1.Binding.decode(reader, reader.uint32())); + break; + case 3: + message.etag = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Policy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.Policy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.Policy} Policy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Policy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Policy message. + * @function verify + * @memberof google.iam.v1.Policy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Policy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version)) + return "version: integer expected"; + if (message.bindings != null && message.hasOwnProperty("bindings")) { + if (!Array.isArray(message.bindings)) + return "bindings: array expected"; + for (var i = 0; i < message.bindings.length; ++i) { + var error = $root.google.iam.v1.Binding.verify(message.bindings[i]); + if (error) + return "bindings." + error; + } + } + if (message.etag != null && message.hasOwnProperty("etag")) + if (!(message.etag && typeof message.etag.length === "number" || $util.isString(message.etag))) + return "etag: buffer expected"; + return null; + }; + + /** + * Creates a Policy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.Policy + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.Policy} Policy + */ + Policy.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.Policy) + return object; + var message = new $root.google.iam.v1.Policy(); + if (object.version != null) + message.version = object.version | 0; + if (object.bindings) { + if (!Array.isArray(object.bindings)) + throw TypeError(".google.iam.v1.Policy.bindings: array expected"); + message.bindings = []; + for (var i = 0; i < object.bindings.length; ++i) { + if (typeof object.bindings[i] !== "object") + throw TypeError(".google.iam.v1.Policy.bindings: object expected"); + message.bindings[i] = $root.google.iam.v1.Binding.fromObject(object.bindings[i]); + } + } + if (object.etag != null) + if (typeof object.etag === "string") + $util.base64.decode(object.etag, message.etag = $util.newBuffer($util.base64.length(object.etag)), 0); + else if (object.etag.length) + message.etag = object.etag; + return message; + }; + + /** + * Creates a plain object from a Policy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.Policy + * @static + * @param {google.iam.v1.Policy} message Policy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Policy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.bindings = []; + if (options.defaults) { + object.version = 0; + if (options.bytes === String) + object.etag = ""; + else { + object.etag = []; + if (options.bytes !== Array) + object.etag = $util.newBuffer(object.etag); + } + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = options.bytes === String ? $util.base64.encode(message.etag, 0, message.etag.length) : options.bytes === Array ? Array.prototype.slice.call(message.etag) : message.etag; + if (message.bindings && message.bindings.length) { + object.bindings = []; + for (var j = 0; j < message.bindings.length; ++j) + object.bindings[j] = $root.google.iam.v1.Binding.toObject(message.bindings[j], options); + } + return object; + }; + + /** + * Converts this Policy to JSON. + * @function toJSON + * @memberof google.iam.v1.Policy + * @instance + * @returns {Object.} JSON object + */ + Policy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Policy; + })(); + + v1.Binding = (function() { + + /** + * Properties of a Binding. + * @memberof google.iam.v1 + * @interface IBinding + * @property {string|null} [role] Binding role + * @property {Array.|null} [members] Binding members + * @property {google.type.IExpr|null} [condition] Binding condition + */ + + /** + * Constructs a new Binding. + * @memberof google.iam.v1 + * @classdesc Represents a Binding. + * @implements IBinding + * @constructor + * @param {google.iam.v1.IBinding=} [properties] Properties to set + */ + function Binding(properties) { + this.members = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Binding role. + * @member {string} role + * @memberof google.iam.v1.Binding + * @instance + */ + Binding.prototype.role = ""; + + /** + * Binding members. + * @member {Array.} members + * @memberof google.iam.v1.Binding + * @instance + */ + Binding.prototype.members = $util.emptyArray; + + /** + * Binding condition. + * @member {google.type.IExpr|null|undefined} condition + * @memberof google.iam.v1.Binding + * @instance + */ + Binding.prototype.condition = null; + + /** + * Creates a new Binding instance using the specified properties. + * @function create + * @memberof google.iam.v1.Binding + * @static + * @param {google.iam.v1.IBinding=} [properties] Properties to set + * @returns {google.iam.v1.Binding} Binding instance + */ + Binding.create = function create(properties) { + return new Binding(properties); + }; + + /** + * Encodes the specified Binding message. Does not implicitly {@link google.iam.v1.Binding.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.Binding + * @static + * @param {google.iam.v1.IBinding} message Binding message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Binding.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.role != null && Object.hasOwnProperty.call(message, "role")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.role); + if (message.members != null && message.members.length) + for (var i = 0; i < message.members.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.members[i]); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + $root.google.type.Expr.encode(message.condition, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Binding message, length delimited. Does not implicitly {@link google.iam.v1.Binding.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.Binding + * @static + * @param {google.iam.v1.IBinding} message Binding message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Binding.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Binding message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.Binding + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.Binding} Binding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Binding.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.Binding(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.role = reader.string(); + break; + case 2: + if (!(message.members && message.members.length)) + message.members = []; + message.members.push(reader.string()); + break; + case 3: + message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Binding message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.Binding + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.Binding} Binding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Binding.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Binding message. + * @function verify + * @memberof google.iam.v1.Binding + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Binding.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.role != null && message.hasOwnProperty("role")) + if (!$util.isString(message.role)) + return "role: string expected"; + if (message.members != null && message.hasOwnProperty("members")) { + if (!Array.isArray(message.members)) + return "members: array expected"; + for (var i = 0; i < message.members.length; ++i) + if (!$util.isString(message.members[i])) + return "members: string[] expected"; + } + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.type.Expr.verify(message.condition); + if (error) + return "condition." + error; + } + return null; + }; + + /** + * Creates a Binding message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.Binding + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.Binding} Binding + */ + Binding.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.Binding) + return object; + var message = new $root.google.iam.v1.Binding(); + if (object.role != null) + message.role = String(object.role); + if (object.members) { + if (!Array.isArray(object.members)) + throw TypeError(".google.iam.v1.Binding.members: array expected"); + message.members = []; + for (var i = 0; i < object.members.length; ++i) + message.members[i] = String(object.members[i]); + } + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.iam.v1.Binding.condition: object expected"); + message.condition = $root.google.type.Expr.fromObject(object.condition); + } + return message; + }; + + /** + * Creates a plain object from a Binding message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.Binding + * @static + * @param {google.iam.v1.Binding} message Binding + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Binding.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.members = []; + if (options.defaults) { + object.role = ""; + object.condition = null; + } + if (message.role != null && message.hasOwnProperty("role")) + object.role = message.role; + if (message.members && message.members.length) { + object.members = []; + for (var j = 0; j < message.members.length; ++j) + object.members[j] = message.members[j]; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.type.Expr.toObject(message.condition, options); + return object; + }; + + /** + * Converts this Binding to JSON. + * @function toJSON + * @memberof google.iam.v1.Binding + * @instance + * @returns {Object.} JSON object + */ + Binding.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Binding; + })(); + + v1.PolicyDelta = (function() { + + /** + * Properties of a PolicyDelta. + * @memberof google.iam.v1 + * @interface IPolicyDelta + * @property {Array.|null} [bindingDeltas] PolicyDelta bindingDeltas + * @property {Array.|null} [auditConfigDeltas] PolicyDelta auditConfigDeltas + */ + + /** + * Constructs a new PolicyDelta. + * @memberof google.iam.v1 + * @classdesc Represents a PolicyDelta. + * @implements IPolicyDelta + * @constructor + * @param {google.iam.v1.IPolicyDelta=} [properties] Properties to set + */ + function PolicyDelta(properties) { + this.bindingDeltas = []; + this.auditConfigDeltas = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PolicyDelta bindingDeltas. + * @member {Array.} bindingDeltas + * @memberof google.iam.v1.PolicyDelta + * @instance + */ + PolicyDelta.prototype.bindingDeltas = $util.emptyArray; + + /** + * PolicyDelta auditConfigDeltas. + * @member {Array.} auditConfigDeltas + * @memberof google.iam.v1.PolicyDelta + * @instance + */ + PolicyDelta.prototype.auditConfigDeltas = $util.emptyArray; + + /** + * Creates a new PolicyDelta instance using the specified properties. + * @function create + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {google.iam.v1.IPolicyDelta=} [properties] Properties to set + * @returns {google.iam.v1.PolicyDelta} PolicyDelta instance + */ + PolicyDelta.create = function create(properties) { + return new PolicyDelta(properties); + }; + + /** + * Encodes the specified PolicyDelta message. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {google.iam.v1.IPolicyDelta} message PolicyDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PolicyDelta.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bindingDeltas != null && message.bindingDeltas.length) + for (var i = 0; i < message.bindingDeltas.length; ++i) + $root.google.iam.v1.BindingDelta.encode(message.bindingDeltas[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.auditConfigDeltas != null && message.auditConfigDeltas.length) + for (var i = 0; i < message.auditConfigDeltas.length; ++i) + $root.google.iam.v1.AuditConfigDelta.encode(message.auditConfigDeltas[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PolicyDelta message, length delimited. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {google.iam.v1.IPolicyDelta} message PolicyDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PolicyDelta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PolicyDelta message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.PolicyDelta} PolicyDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PolicyDelta.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.PolicyDelta(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.bindingDeltas && message.bindingDeltas.length)) + message.bindingDeltas = []; + message.bindingDeltas.push($root.google.iam.v1.BindingDelta.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.auditConfigDeltas && message.auditConfigDeltas.length)) + message.auditConfigDeltas = []; + message.auditConfigDeltas.push($root.google.iam.v1.AuditConfigDelta.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PolicyDelta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.PolicyDelta} PolicyDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PolicyDelta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PolicyDelta message. + * @function verify + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PolicyDelta.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bindingDeltas != null && message.hasOwnProperty("bindingDeltas")) { + if (!Array.isArray(message.bindingDeltas)) + return "bindingDeltas: array expected"; + for (var i = 0; i < message.bindingDeltas.length; ++i) { + var error = $root.google.iam.v1.BindingDelta.verify(message.bindingDeltas[i]); + if (error) + return "bindingDeltas." + error; + } + } + if (message.auditConfigDeltas != null && message.hasOwnProperty("auditConfigDeltas")) { + if (!Array.isArray(message.auditConfigDeltas)) + return "auditConfigDeltas: array expected"; + for (var i = 0; i < message.auditConfigDeltas.length; ++i) { + var error = $root.google.iam.v1.AuditConfigDelta.verify(message.auditConfigDeltas[i]); + if (error) + return "auditConfigDeltas." + error; + } + } + return null; + }; + + /** + * Creates a PolicyDelta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.PolicyDelta} PolicyDelta + */ + PolicyDelta.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.PolicyDelta) + return object; + var message = new $root.google.iam.v1.PolicyDelta(); + if (object.bindingDeltas) { + if (!Array.isArray(object.bindingDeltas)) + throw TypeError(".google.iam.v1.PolicyDelta.bindingDeltas: array expected"); + message.bindingDeltas = []; + for (var i = 0; i < object.bindingDeltas.length; ++i) { + if (typeof object.bindingDeltas[i] !== "object") + throw TypeError(".google.iam.v1.PolicyDelta.bindingDeltas: object expected"); + message.bindingDeltas[i] = $root.google.iam.v1.BindingDelta.fromObject(object.bindingDeltas[i]); + } + } + if (object.auditConfigDeltas) { + if (!Array.isArray(object.auditConfigDeltas)) + throw TypeError(".google.iam.v1.PolicyDelta.auditConfigDeltas: array expected"); + message.auditConfigDeltas = []; + for (var i = 0; i < object.auditConfigDeltas.length; ++i) { + if (typeof object.auditConfigDeltas[i] !== "object") + throw TypeError(".google.iam.v1.PolicyDelta.auditConfigDeltas: object expected"); + message.auditConfigDeltas[i] = $root.google.iam.v1.AuditConfigDelta.fromObject(object.auditConfigDeltas[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PolicyDelta message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {google.iam.v1.PolicyDelta} message PolicyDelta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PolicyDelta.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.bindingDeltas = []; + object.auditConfigDeltas = []; + } + if (message.bindingDeltas && message.bindingDeltas.length) { + object.bindingDeltas = []; + for (var j = 0; j < message.bindingDeltas.length; ++j) + object.bindingDeltas[j] = $root.google.iam.v1.BindingDelta.toObject(message.bindingDeltas[j], options); + } + if (message.auditConfigDeltas && message.auditConfigDeltas.length) { + object.auditConfigDeltas = []; + for (var j = 0; j < message.auditConfigDeltas.length; ++j) + object.auditConfigDeltas[j] = $root.google.iam.v1.AuditConfigDelta.toObject(message.auditConfigDeltas[j], options); + } + return object; + }; + + /** + * Converts this PolicyDelta to JSON. + * @function toJSON + * @memberof google.iam.v1.PolicyDelta + * @instance + * @returns {Object.} JSON object + */ + PolicyDelta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PolicyDelta; + })(); + + v1.BindingDelta = (function() { + + /** + * Properties of a BindingDelta. + * @memberof google.iam.v1 + * @interface IBindingDelta + * @property {google.iam.v1.BindingDelta.Action|null} [action] BindingDelta action + * @property {string|null} [role] BindingDelta role + * @property {string|null} [member] BindingDelta member + * @property {google.type.IExpr|null} [condition] BindingDelta condition + */ + + /** + * Constructs a new BindingDelta. + * @memberof google.iam.v1 + * @classdesc Represents a BindingDelta. + * @implements IBindingDelta + * @constructor + * @param {google.iam.v1.IBindingDelta=} [properties] Properties to set + */ + function BindingDelta(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BindingDelta action. + * @member {google.iam.v1.BindingDelta.Action} action + * @memberof google.iam.v1.BindingDelta + * @instance + */ + BindingDelta.prototype.action = 0; + + /** + * BindingDelta role. + * @member {string} role + * @memberof google.iam.v1.BindingDelta + * @instance + */ + BindingDelta.prototype.role = ""; + + /** + * BindingDelta member. + * @member {string} member + * @memberof google.iam.v1.BindingDelta + * @instance + */ + BindingDelta.prototype.member = ""; + + /** + * BindingDelta condition. + * @member {google.type.IExpr|null|undefined} condition + * @memberof google.iam.v1.BindingDelta + * @instance + */ + BindingDelta.prototype.condition = null; + + /** + * Creates a new BindingDelta instance using the specified properties. + * @function create + * @memberof google.iam.v1.BindingDelta + * @static + * @param {google.iam.v1.IBindingDelta=} [properties] Properties to set + * @returns {google.iam.v1.BindingDelta} BindingDelta instance + */ + BindingDelta.create = function create(properties) { + return new BindingDelta(properties); + }; + + /** + * Encodes the specified BindingDelta message. Does not implicitly {@link google.iam.v1.BindingDelta.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.BindingDelta + * @static + * @param {google.iam.v1.IBindingDelta} message BindingDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BindingDelta.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.action); + if (message.role != null && Object.hasOwnProperty.call(message, "role")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.role); + if (message.member != null && Object.hasOwnProperty.call(message, "member")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.member); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + $root.google.type.Expr.encode(message.condition, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BindingDelta message, length delimited. Does not implicitly {@link google.iam.v1.BindingDelta.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.BindingDelta + * @static + * @param {google.iam.v1.IBindingDelta} message BindingDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BindingDelta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BindingDelta message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.BindingDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.BindingDelta} BindingDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BindingDelta.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.BindingDelta(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.action = reader.int32(); + break; + case 2: + message.role = reader.string(); + break; + case 3: + message.member = reader.string(); + break; + case 4: + message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BindingDelta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.BindingDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.BindingDelta} BindingDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BindingDelta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BindingDelta message. + * @function verify + * @memberof google.iam.v1.BindingDelta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BindingDelta.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.action != null && message.hasOwnProperty("action")) + switch (message.action) { + default: + return "action: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.role != null && message.hasOwnProperty("role")) + if (!$util.isString(message.role)) + return "role: string expected"; + if (message.member != null && message.hasOwnProperty("member")) + if (!$util.isString(message.member)) + return "member: string expected"; + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.type.Expr.verify(message.condition); + if (error) + return "condition." + error; + } + return null; + }; + + /** + * Creates a BindingDelta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.BindingDelta + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.BindingDelta} BindingDelta + */ + BindingDelta.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.BindingDelta) + return object; + var message = new $root.google.iam.v1.BindingDelta(); + switch (object.action) { + case "ACTION_UNSPECIFIED": + case 0: + message.action = 0; + break; + case "ADD": + case 1: + message.action = 1; + break; + case "REMOVE": + case 2: + message.action = 2; + break; + } + if (object.role != null) + message.role = String(object.role); + if (object.member != null) + message.member = String(object.member); + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.iam.v1.BindingDelta.condition: object expected"); + message.condition = $root.google.type.Expr.fromObject(object.condition); + } + return message; + }; + + /** + * Creates a plain object from a BindingDelta message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.BindingDelta + * @static + * @param {google.iam.v1.BindingDelta} message BindingDelta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BindingDelta.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.action = options.enums === String ? "ACTION_UNSPECIFIED" : 0; + object.role = ""; + object.member = ""; + object.condition = null; + } + if (message.action != null && message.hasOwnProperty("action")) + object.action = options.enums === String ? $root.google.iam.v1.BindingDelta.Action[message.action] : message.action; + if (message.role != null && message.hasOwnProperty("role")) + object.role = message.role; + if (message.member != null && message.hasOwnProperty("member")) + object.member = message.member; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.type.Expr.toObject(message.condition, options); + return object; + }; + + /** + * Converts this BindingDelta to JSON. + * @function toJSON + * @memberof google.iam.v1.BindingDelta + * @instance + * @returns {Object.} JSON object + */ + BindingDelta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Action enum. + * @name google.iam.v1.BindingDelta.Action + * @enum {number} + * @property {number} ACTION_UNSPECIFIED=0 ACTION_UNSPECIFIED value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + */ + BindingDelta.Action = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + return values; + })(); + + return BindingDelta; + })(); + + v1.AuditConfigDelta = (function() { + + /** + * Properties of an AuditConfigDelta. + * @memberof google.iam.v1 + * @interface IAuditConfigDelta + * @property {google.iam.v1.AuditConfigDelta.Action|null} [action] AuditConfigDelta action + * @property {string|null} [service] AuditConfigDelta service + * @property {string|null} [exemptedMember] AuditConfigDelta exemptedMember + * @property {string|null} [logType] AuditConfigDelta logType + */ + + /** + * Constructs a new AuditConfigDelta. + * @memberof google.iam.v1 + * @classdesc Represents an AuditConfigDelta. + * @implements IAuditConfigDelta + * @constructor + * @param {google.iam.v1.IAuditConfigDelta=} [properties] Properties to set + */ + function AuditConfigDelta(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AuditConfigDelta action. + * @member {google.iam.v1.AuditConfigDelta.Action} action + * @memberof google.iam.v1.AuditConfigDelta + * @instance + */ + AuditConfigDelta.prototype.action = 0; + + /** + * AuditConfigDelta service. + * @member {string} service + * @memberof google.iam.v1.AuditConfigDelta + * @instance + */ + AuditConfigDelta.prototype.service = ""; + + /** + * AuditConfigDelta exemptedMember. + * @member {string} exemptedMember + * @memberof google.iam.v1.AuditConfigDelta + * @instance + */ + AuditConfigDelta.prototype.exemptedMember = ""; + + /** + * AuditConfigDelta logType. + * @member {string} logType + * @memberof google.iam.v1.AuditConfigDelta + * @instance + */ + AuditConfigDelta.prototype.logType = ""; + + /** + * Creates a new AuditConfigDelta instance using the specified properties. + * @function create + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {google.iam.v1.IAuditConfigDelta=} [properties] Properties to set + * @returns {google.iam.v1.AuditConfigDelta} AuditConfigDelta instance + */ + AuditConfigDelta.create = function create(properties) { + return new AuditConfigDelta(properties); + }; + + /** + * Encodes the specified AuditConfigDelta message. Does not implicitly {@link google.iam.v1.AuditConfigDelta.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {google.iam.v1.IAuditConfigDelta} message AuditConfigDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditConfigDelta.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.action); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.service); + if (message.exemptedMember != null && Object.hasOwnProperty.call(message, "exemptedMember")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.exemptedMember); + if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.logType); + return writer; + }; + + /** + * Encodes the specified AuditConfigDelta message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfigDelta.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {google.iam.v1.IAuditConfigDelta} message AuditConfigDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditConfigDelta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AuditConfigDelta message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.AuditConfigDelta} AuditConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditConfigDelta.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.AuditConfigDelta(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.action = reader.int32(); + break; + case 2: + message.service = reader.string(); + break; + case 3: + message.exemptedMember = reader.string(); + break; + case 4: + message.logType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AuditConfigDelta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.AuditConfigDelta} AuditConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditConfigDelta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AuditConfigDelta message. + * @function verify + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AuditConfigDelta.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.action != null && message.hasOwnProperty("action")) + switch (message.action) { + default: + return "action: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.exemptedMember != null && message.hasOwnProperty("exemptedMember")) + if (!$util.isString(message.exemptedMember)) + return "exemptedMember: string expected"; + if (message.logType != null && message.hasOwnProperty("logType")) + if (!$util.isString(message.logType)) + return "logType: string expected"; + return null; + }; + + /** + * Creates an AuditConfigDelta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.AuditConfigDelta} AuditConfigDelta + */ + AuditConfigDelta.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.AuditConfigDelta) + return object; + var message = new $root.google.iam.v1.AuditConfigDelta(); + switch (object.action) { + case "ACTION_UNSPECIFIED": + case 0: + message.action = 0; + break; + case "ADD": + case 1: + message.action = 1; + break; + case "REMOVE": + case 2: + message.action = 2; + break; + } + if (object.service != null) + message.service = String(object.service); + if (object.exemptedMember != null) + message.exemptedMember = String(object.exemptedMember); + if (object.logType != null) + message.logType = String(object.logType); + return message; + }; + + /** + * Creates a plain object from an AuditConfigDelta message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {google.iam.v1.AuditConfigDelta} message AuditConfigDelta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuditConfigDelta.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.action = options.enums === String ? "ACTION_UNSPECIFIED" : 0; + object.service = ""; + object.exemptedMember = ""; + object.logType = ""; + } + if (message.action != null && message.hasOwnProperty("action")) + object.action = options.enums === String ? $root.google.iam.v1.AuditConfigDelta.Action[message.action] : message.action; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.exemptedMember != null && message.hasOwnProperty("exemptedMember")) + object.exemptedMember = message.exemptedMember; + if (message.logType != null && message.hasOwnProperty("logType")) + object.logType = message.logType; + return object; + }; + + /** + * Converts this AuditConfigDelta to JSON. + * @function toJSON + * @memberof google.iam.v1.AuditConfigDelta + * @instance + * @returns {Object.} JSON object + */ + AuditConfigDelta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Action enum. + * @name google.iam.v1.AuditConfigDelta.Action + * @enum {number} + * @property {number} ACTION_UNSPECIFIED=0 ACTION_UNSPECIFIED value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + */ + AuditConfigDelta.Action = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + return values; + })(); + + return AuditConfigDelta; + })(); + + return v1; + })(); + + return iam; + })(); + + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + type.Expr = (function() { + + /** + * Properties of an Expr. + * @memberof google.type + * @interface IExpr + * @property {string|null} [expression] Expr expression + * @property {string|null} [title] Expr title + * @property {string|null} [description] Expr description + * @property {string|null} [location] Expr location + */ + + /** + * Constructs a new Expr. + * @memberof google.type + * @classdesc Represents an Expr. + * @implements IExpr + * @constructor + * @param {google.type.IExpr=} [properties] Properties to set + */ + function Expr(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Expr expression. + * @member {string} expression + * @memberof google.type.Expr + * @instance + */ + Expr.prototype.expression = ""; + + /** + * Expr title. + * @member {string} title + * @memberof google.type.Expr + * @instance + */ + Expr.prototype.title = ""; + + /** + * Expr description. + * @member {string} description + * @memberof google.type.Expr + * @instance + */ + Expr.prototype.description = ""; + + /** + * Expr location. + * @member {string} location + * @memberof google.type.Expr + * @instance + */ + Expr.prototype.location = ""; + + /** + * Creates a new Expr instance using the specified properties. + * @function create + * @memberof google.type.Expr + * @static + * @param {google.type.IExpr=} [properties] Properties to set + * @returns {google.type.Expr} Expr instance + */ + Expr.create = function create(properties) { + return new Expr(properties); + }; + + /** + * Encodes the specified Expr message. Does not implicitly {@link google.type.Expr.verify|verify} messages. + * @function encode + * @memberof google.type.Expr + * @static + * @param {google.type.IExpr} message Expr message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Expr.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expression != null && Object.hasOwnProperty.call(message, "expression")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.expression); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.location); + return writer; + }; + + /** + * Encodes the specified Expr message, length delimited. Does not implicitly {@link google.type.Expr.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Expr + * @static + * @param {google.type.IExpr} message Expr message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Expr.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Expr message from the specified reader or buffer. + * @function decode + * @memberof google.type.Expr + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.type.Expr} Expr + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Expr.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Expr(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expression = reader.string(); + break; + case 2: + message.title = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.location = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Expr message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Expr + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.type.Expr} Expr + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Expr.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Expr message. + * @function verify + * @memberof google.type.Expr + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Expr.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expression != null && message.hasOwnProperty("expression")) + if (!$util.isString(message.expression)) + return "expression: string expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + return null; + }; + + /** + * Creates an Expr message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Expr + * @static + * @param {Object.} object Plain object + * @returns {google.type.Expr} Expr + */ + Expr.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Expr) + return object; + var message = new $root.google.type.Expr(); + if (object.expression != null) + message.expression = String(object.expression); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.location != null) + message.location = String(object.location); + return message; + }; + + /** + * Creates a plain object from an Expr message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Expr + * @static + * @param {google.type.Expr} message Expr + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Expr.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.expression = ""; + object.title = ""; + object.description = ""; + object.location = ""; + } + if (message.expression != null && message.hasOwnProperty("expression")) + object.expression = message.expression; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + return object; + }; + + /** + * Converts this Expr to JSON. + * @function toJSON + * @memberof google.type.Expr + * @instance + * @returns {Object.} JSON object + */ + Expr.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Expr; + })(); + + return type; + })(); + + google.longrunning = (function() { + + /** + * Namespace longrunning. + * @memberof google + * @namespace + */ + var longrunning = {}; + + longrunning.Operations = (function() { + + /** + * Constructs a new Operations service. + * @memberof google.longrunning + * @classdesc Represents an Operations + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Operations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; + + /** + * Creates new Operations service using the specified rpc implementation. + * @function create + * @memberof google.longrunning.Operations + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Operations} RPC service. Useful where requests and/or responses are streamed. + */ + Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.longrunning.Operations#listOperations}. + * @memberof google.longrunning.Operations + * @typedef ListOperationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse + */ + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { + return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); + }, "name", { value: "ListOperations" }); + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations#getOperation}. + * @memberof google.longrunning.Operations + * @typedef GetOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { + return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "GetOperation" }); + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * @memberof google.longrunning.Operations + * @typedef DeleteOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { + return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteOperation" }); + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * @memberof google.longrunning.Operations + * @typedef CancelOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { + return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CancelOperation" }); + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * @memberof google.longrunning.Operations + * @typedef WaitOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { + return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "WaitOperation" }); + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Operations; + })(); + + longrunning.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.longrunning + * @interface IOperation + * @property {string|null} [name] Operation name + * @property {google.protobuf.IAny|null} [metadata] Operation metadata + * @property {boolean|null} [done] Operation done + * @property {google.rpc.IStatus|null} [error] Operation error + * @property {google.protobuf.IAny|null} [response] Operation response + */ + + /** + * Constructs a new Operation. + * @memberof google.longrunning + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.longrunning.IOperation=} [properties] Properties to set + */ + function Operation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Operation name. + * @member {string} name + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation metadata. + * @member {google.protobuf.IAny|null|undefined} metadata + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.metadata = null; + + /** + * Operation done. + * @member {boolean} done + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.done = false; + + /** + * Operation error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation response. + * @member {google.protobuf.IAny|null|undefined} response + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.response = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Operation result. + * @member {"error"|"response"|undefined} result + * @memberof google.longrunning.Operation + * @instance + */ + Object.defineProperty(Operation.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "response"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation=} [properties] Properties to set + * @returns {google.longrunning.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encode + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.response != null && Object.hasOwnProperty.call(message, "response")) + $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.Operation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.done = reader.bool(); + break; + case 4: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 5: + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.longrunning.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Any.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.done != null && message.hasOwnProperty("done")) + if (typeof message.done !== "boolean") + return "done: boolean expected"; + if (message.error != null && message.hasOwnProperty("error")) { + properties.result = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.response != null && message.hasOwnProperty("response")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.google.protobuf.Any.verify(message.response); + if (error) + return "response." + error; + } + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.Operation} Operation + */ + Operation.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.Operation) + return object; + var message = new $root.google.longrunning.Operation(); + if (object.name != null) + message.name = String(object.name); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.longrunning.Operation.metadata: object expected"); + message.metadata = $root.google.protobuf.Any.fromObject(object.metadata); + } + if (object.done != null) + message.done = Boolean(object.done); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.longrunning.Operation.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.response != null) { + if (typeof object.response !== "object") + throw TypeError(".google.longrunning.Operation.response: object expected"); + message.response = $root.google.protobuf.Any.fromObject(object.response); + } + return message; + }; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.Operation} message Operation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Operation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.metadata = null; + object.done = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options); + if (message.done != null && message.hasOwnProperty("done")) + object.done = message.done; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.result = "error"; + } + if (message.response != null && message.hasOwnProperty("response")) { + object.response = $root.google.protobuf.Any.toObject(message.response, options); + if (options.oneofs) + object.result = "response"; + } + return object; + }; + + /** + * Converts this Operation to JSON. + * @function toJSON + * @memberof google.longrunning.Operation + * @instance + * @returns {Object.} JSON object + */ + Operation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Operation; + })(); + + longrunning.GetOperationRequest = (function() { + + /** + * Properties of a GetOperationRequest. + * @memberof google.longrunning + * @interface IGetOperationRequest + * @property {string|null} [name] GetOperationRequest name + */ + + /** + * Constructs a new GetOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a GetOperationRequest. + * @implements IGetOperationRequest + * @constructor + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + */ + function GetOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetOperationRequest name. + * @member {string} name + * @memberof google.longrunning.GetOperationRequest + * @instance + */ + GetOperationRequest.prototype.name = ""; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance + */ + GetOperationRequest.create = function create(properties) { + return new GetOperationRequest(properties); + }; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.GetOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetOperationRequest message. + * @function verify + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + */ + GetOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.GetOperationRequest) + return object; + var message = new $root.google.longrunning.GetOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.GetOperationRequest} message GetOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.GetOperationRequest + * @instance + * @returns {Object.} JSON object + */ + GetOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetOperationRequest; + })(); + + longrunning.ListOperationsRequest = (function() { + + /** + * Properties of a ListOperationsRequest. + * @memberof google.longrunning + * @interface IListOperationsRequest + * @property {string|null} [name] ListOperationsRequest name + * @property {string|null} [filter] ListOperationsRequest filter + * @property {number|null} [pageSize] ListOperationsRequest pageSize + * @property {string|null} [pageToken] ListOperationsRequest pageToken + */ + + /** + * Constructs a new ListOperationsRequest. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsRequest. + * @implements IListOperationsRequest + * @constructor + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + */ + function ListOperationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsRequest name. + * @member {string} name + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.name = ""; + + /** + * ListOperationsRequest filter. + * @member {string} filter + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.filter = ""; + + /** + * ListOperationsRequest pageSize. + * @member {number} pageSize + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageSize = 0; + + /** + * ListOperationsRequest pageToken. + * @member {string} pageToken + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest instance + */ + ListOperationsRequest.create = function create(properties) { + return new ListOperationsRequest(properties); + }; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.name = reader.string(); + break; + case 1: + message.filter = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsRequest message. + * @function verify + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + */ + ListOperationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsRequest) + return object; + var message = new $root.google.longrunning.ListOperationsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.ListOperationsRequest} message ListOperationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListOperationsRequest to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListOperationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListOperationsRequest; + })(); + + longrunning.ListOperationsResponse = (function() { + + /** + * Properties of a ListOperationsResponse. + * @memberof google.longrunning + * @interface IListOperationsResponse + * @property {Array.|null} [operations] ListOperationsResponse operations + * @property {string|null} [nextPageToken] ListOperationsResponse nextPageToken + */ + + /** + * Constructs a new ListOperationsResponse. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsResponse. + * @implements IListOperationsResponse + * @constructor + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + */ + function ListOperationsResponse(properties) { + this.operations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsResponse operations. + * @member {Array.} operations + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.operations = $util.emptyArray; + + /** + * ListOperationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse instance + */ + ListOperationsResponse.create = function create(properties) { + return new ListOperationsResponse(properties); + }; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operations != null && message.operations.length) + for (var i = 0; i < message.operations.length; ++i) + $root.google.longrunning.Operation.encode(message.operations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.operations && message.operations.length)) + message.operations = []; + message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsResponse message. + * @function verify + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operations != null && message.hasOwnProperty("operations")) { + if (!Array.isArray(message.operations)) + return "operations: array expected"; + for (var i = 0; i < message.operations.length; ++i) { + var error = $root.google.longrunning.Operation.verify(message.operations[i]); + if (error) + return "operations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + */ + ListOperationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsResponse) + return object; + var message = new $root.google.longrunning.ListOperationsResponse(); + if (object.operations) { + if (!Array.isArray(object.operations)) + throw TypeError(".google.longrunning.ListOperationsResponse.operations: array expected"); + message.operations = []; + for (var i = 0; i < object.operations.length; ++i) { + if (typeof object.operations[i] !== "object") + throw TypeError(".google.longrunning.ListOperationsResponse.operations: object expected"); + message.operations[i] = $root.google.longrunning.Operation.fromObject(object.operations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.ListOperationsResponse} message ListOperationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.operations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.operations && message.operations.length) { + object.operations = []; + for (var j = 0; j < message.operations.length; ++j) + object.operations[j] = $root.google.longrunning.Operation.toObject(message.operations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListOperationsResponse to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListOperationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListOperationsResponse; + })(); + + longrunning.CancelOperationRequest = (function() { + + /** + * Properties of a CancelOperationRequest. + * @memberof google.longrunning + * @interface ICancelOperationRequest + * @property {string|null} [name] CancelOperationRequest name + */ + + /** + * Constructs a new CancelOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a CancelOperationRequest. + * @implements ICancelOperationRequest + * @constructor + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + */ + function CancelOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CancelOperationRequest name. + * @member {string} name + * @memberof google.longrunning.CancelOperationRequest + * @instance + */ + CancelOperationRequest.prototype.name = ""; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest instance + */ + CancelOperationRequest.create = function create(properties) { + return new CancelOperationRequest(properties); + }; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.CancelOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CancelOperationRequest message. + * @function verify + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CancelOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + */ + CancelOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.CancelOperationRequest) + return object; + var message = new $root.google.longrunning.CancelOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.CancelOperationRequest} message CancelOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CancelOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CancelOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.CancelOperationRequest + * @instance + * @returns {Object.} JSON object + */ + CancelOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CancelOperationRequest; + })(); + + longrunning.DeleteOperationRequest = (function() { + + /** + * Properties of a DeleteOperationRequest. + * @memberof google.longrunning + * @interface IDeleteOperationRequest + * @property {string|null} [name] DeleteOperationRequest name + */ + + /** + * Constructs a new DeleteOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a DeleteOperationRequest. + * @implements IDeleteOperationRequest + * @constructor + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + */ + function DeleteOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteOperationRequest name. + * @member {string} name + * @memberof google.longrunning.DeleteOperationRequest + * @instance + */ + DeleteOperationRequest.prototype.name = ""; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest instance + */ + DeleteOperationRequest.create = function create(properties) { + return new DeleteOperationRequest(properties); + }; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.DeleteOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteOperationRequest message. + * @function verify + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + */ + DeleteOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.DeleteOperationRequest) + return object; + var message = new $root.google.longrunning.DeleteOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.DeleteOperationRequest} message DeleteOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.DeleteOperationRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteOperationRequest; + })(); + + longrunning.WaitOperationRequest = (function() { + + /** + * Properties of a WaitOperationRequest. + * @memberof google.longrunning + * @interface IWaitOperationRequest + * @property {string|null} [name] WaitOperationRequest name + * @property {google.protobuf.IDuration|null} [timeout] WaitOperationRequest timeout + */ + + /** + * Constructs a new WaitOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a WaitOperationRequest. + * @implements IWaitOperationRequest + * @constructor + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + */ + function WaitOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitOperationRequest name. + * @member {string} name + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.name = ""; + + /** + * WaitOperationRequest timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.timeout = null; + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest instance + */ + WaitOperationRequest.create = function create(properties) { + return new WaitOperationRequest(properties); + }; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.WaitOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitOperationRequest message. + * @function verify + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + return null; + }; + + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + */ + WaitOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.WaitOperationRequest) + return object; + var message = new $root.google.longrunning.WaitOperationRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + return message; + }; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.WaitOperationRequest} message WaitOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.timeout = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + return object; + }; + + /** + * Converts this WaitOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.WaitOperationRequest + * @instance + * @returns {Object.} JSON object + */ + WaitOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WaitOperationRequest; + })(); + + longrunning.OperationInfo = (function() { + + /** + * Properties of an OperationInfo. + * @memberof google.longrunning + * @interface IOperationInfo + * @property {string|null} [responseType] OperationInfo responseType + * @property {string|null} [metadataType] OperationInfo metadataType + */ + + /** + * Constructs a new OperationInfo. + * @memberof google.longrunning + * @classdesc Represents an OperationInfo. + * @implements IOperationInfo + * @constructor + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + */ + function OperationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationInfo responseType. + * @member {string} responseType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.responseType = ""; + + /** + * OperationInfo metadataType. + * @member {string} metadataType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.metadataType = ""; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @function create + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + * @returns {google.longrunning.OperationInfo} OperationInfo instance + */ + OperationInfo.create = function create(properties) { + return new OperationInfo(properties); + }; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encode + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); + return writer; + }; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.OperationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.responseType = reader.string(); + break; + case 2: + message.metadataType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationInfo message. + * @function verify + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseType != null && message.hasOwnProperty("responseType")) + if (!$util.isString(message.responseType)) + return "responseType: string expected"; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + if (!$util.isString(message.metadataType)) + return "metadataType: string expected"; + return null; + }; + + /** + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.OperationInfo} OperationInfo + */ + OperationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.OperationInfo) + return object; + var message = new $root.google.longrunning.OperationInfo(); + if (object.responseType != null) + message.responseType = String(object.responseType); + if (object.metadataType != null) + message.metadataType = String(object.metadataType); + return message; + }; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.OperationInfo} message OperationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseType = ""; + object.metadataType = ""; + } + if (message.responseType != null && message.hasOwnProperty("responseType")) + object.responseType = message.responseType; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + object.metadataType = message.metadataType; + return object; + }; + + /** + * Converts this OperationInfo to JSON. + * @function toJSON + * @memberof google.longrunning.OperationInfo + * @instance + * @returns {Object.} JSON object + */ + OperationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationInfo; + })(); + + return longrunning; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { + + /** + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details + */ + + /** + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {google.rpc.IStatus=} [properties] Properties to set + */ + function Status(properties) { + this.details = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Status code. + * @member {number} code + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Status message. + * @member {string} message + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.message = ""; + + /** + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encode + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.int32(); + break; + case 2: + message.message = reader.string(); + break; + case 3: + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof google.rpc.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.rpc.Status + * @static + * @param {Object.} object Plain object + * @returns {google.rpc.Status} Status + */ + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) + return object; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof google.rpc.Status + * @static + * @param {google.rpc.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.details = []; + if (options.defaults) { + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); + } + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof google.rpc.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Status; + })(); + + return rpc; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json new file mode 100644 index 00000000000..e99a0a0b65f --- /dev/null +++ b/packages/google-cloud-functions/protos/protos.json @@ -0,0 +1,2157 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "functions": { + "nested": { + "v1": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/functions/v1;functions", + "java_multiple_files": true, + "java_outer_classname": "FunctionsOperationsProto", + "java_package": "com.google.cloud.functions.v1", + "objc_class_prefix": "GCF" + }, + "nested": { + "CloudFunctionsService": { + "options": { + "(google.api.default_host)": "cloudfunctions.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListFunctions": { + "requestType": "ListFunctionsRequest", + "responseType": "ListFunctionsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/functions" + } + }, + "GetFunction": { + "requestType": "GetFunctionRequest", + "responseType": "CloudFunction", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name" + } + }, + "CreateFunction": { + "requestType": "CreateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{location=projects/*/locations/*}/functions", + "(google.api.http).body": "function", + "(google.api.method_signature)": "location,function", + "(google.longrunning.operation_info).response_type": "CloudFunction", + "(google.longrunning.operation_info).metadata_type": "OperationMetadataV1" + } + }, + "UpdateFunction": { + "requestType": "UpdateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{function.name=projects/*/locations/*/functions/*}", + "(google.api.http).body": "function", + "(google.api.method_signature)": "function", + "(google.longrunning.operation_info).response_type": "CloudFunction", + "(google.longrunning.operation_info).metadata_type": "OperationMetadataV1" + } + }, + "DeleteFunction": { + "requestType": "DeleteFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "OperationMetadataV1" + } + }, + "CallFunction": { + "requestType": "CallFunctionRequest", + "responseType": "CallFunctionResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/functions/*}:call", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,data" + } + }, + "GenerateUploadUrl": { + "requestType": "GenerateUploadUrlRequest", + "responseType": "GenerateUploadUrlResponse", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "(google.api.http).body": "*" + } + }, + "GenerateDownloadUrl": { + "requestType": "GenerateDownloadUrlRequest", + "responseType": "GenerateDownloadUrlResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "(google.api.http).body": "*" + } + }, + "SetIamPolicy": { + "requestType": "google.iam.v1.SetIamPolicyRequest", + "responseType": "google.iam.v1.Policy", + "options": { + "(google.api.http).post": "/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy", + "(google.api.http).body": "*" + } + }, + "GetIamPolicy": { + "requestType": "google.iam.v1.GetIamPolicyRequest", + "responseType": "google.iam.v1.Policy", + "options": { + "(google.api.http).get": "/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy" + } + }, + "TestIamPermissions": { + "requestType": "google.iam.v1.TestIamPermissionsRequest", + "responseType": "google.iam.v1.TestIamPermissionsResponse", + "options": { + "(google.api.http).post": "/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions", + "(google.api.http).body": "*" + } + } + } + }, + "CloudFunction": { + "options": { + "(google.api.resource).type": "cloudfunctions.googleapis.com/CloudFunction", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/functions/{function}" + }, + "oneofs": { + "sourceCode": { + "oneof": [ + "sourceArchiveUrl", + "sourceRepository", + "sourceUploadUrl" + ] + }, + "trigger": { + "oneof": [ + "httpsTrigger", + "eventTrigger" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "sourceArchiveUrl": { + "type": "string", + "id": 3 + }, + "sourceRepository": { + "type": "SourceRepository", + "id": 4 + }, + "sourceUploadUrl": { + "type": "string", + "id": 16 + }, + "httpsTrigger": { + "type": "HttpsTrigger", + "id": 5 + }, + "eventTrigger": { + "type": "EventTrigger", + "id": 6 + }, + "status": { + "type": "CloudFunctionStatus", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "entryPoint": { + "type": "string", + "id": 8 + }, + "runtime": { + "type": "string", + "id": 19 + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 9 + }, + "availableMemoryMb": { + "type": "int32", + "id": 10 + }, + "serviceAccountEmail": { + "type": "string", + "id": 11 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "versionId": { + "type": "int64", + "id": 14, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 15 + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 17 + }, + "network": { + "type": "string", + "id": 18 + }, + "maxInstances": { + "type": "int32", + "id": 20 + }, + "vpcConnector": { + "type": "string", + "id": 22 + }, + "vpcConnectorEgressSettings": { + "type": "VpcConnectorEgressSettings", + "id": 23 + }, + "ingressSettings": { + "type": "IngressSettings", + "id": 24 + }, + "buildId": { + "type": "string", + "id": 27, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "VpcConnectorEgressSettings": { + "values": { + "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": 0, + "PRIVATE_RANGES_ONLY": 1, + "ALL_TRAFFIC": 2 + } + }, + "IngressSettings": { + "values": { + "INGRESS_SETTINGS_UNSPECIFIED": 0, + "ALLOW_ALL": 1, + "ALLOW_INTERNAL_ONLY": 2, + "ALLOW_INTERNAL_AND_GCLB": 3 + } + } + } + }, + "SourceRepository": { + "fields": { + "url": { + "type": "string", + "id": 1 + }, + "deployedUrl": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "HttpsTrigger": { + "fields": { + "url": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "EventTrigger": { + "fields": { + "eventType": { + "type": "string", + "id": 1 + }, + "resource": { + "type": "string", + "id": 2 + }, + "service": { + "type": "string", + "id": 3 + }, + "failurePolicy": { + "type": "FailurePolicy", + "id": 5 + } + } + }, + "FailurePolicy": { + "oneofs": { + "action": { + "oneof": [ + "retry" + ] + } + }, + "fields": { + "retry": { + "type": "Retry", + "id": 1 + } + }, + "nested": { + "Retry": { + "fields": {} + } + } + }, + "CreateFunctionRequest": { + "fields": { + "location": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "function": { + "type": "CloudFunction", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateFunctionRequest": { + "fields": { + "function": { + "type": "CloudFunction", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "GetFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/CloudFunction" + } + } + } + }, + "CloudFunctionStatus": { + "values": { + "CLOUD_FUNCTION_STATUS_UNSPECIFIED": 0, + "ACTIVE": 1, + "OFFLINE": 2, + "DEPLOY_IN_PROGRESS": 3, + "DELETE_IN_PROGRESS": 4, + "UNKNOWN": 5 + } + }, + "ListFunctionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListFunctionsResponse": { + "fields": { + "functions": { + "rule": "repeated", + "type": "CloudFunction", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "DeleteFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/CloudFunction" + } + } + } + }, + "CallFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/CloudFunction" + } + }, + "data": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CallFunctionResponse": { + "fields": { + "executionId": { + "type": "string", + "id": 1 + }, + "result": { + "type": "string", + "id": 2 + }, + "error": { + "type": "string", + "id": 3 + } + } + }, + "GenerateUploadUrlRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + } + } + }, + "GenerateUploadUrlResponse": { + "fields": { + "uploadUrl": { + "type": "string", + "id": 1 + } + } + }, + "GenerateDownloadUrlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "versionId": { + "type": "uint64", + "id": 2 + } + } + }, + "GenerateDownloadUrlResponse": { + "fields": { + "downloadUrl": { + "type": "string", + "id": 1 + } + } + }, + "OperationType": { + "values": { + "OPERATION_UNSPECIFIED": 0, + "CREATE_FUNCTION": 1, + "UPDATE_FUNCTION": 2, + "DELETE_FUNCTION": 3 + } + }, + "OperationMetadataV1": { + "fields": { + "target": { + "type": "string", + "id": 1 + }, + "type": { + "type": "OperationType", + "id": 2 + }, + "request": { + "type": "google.protobuf.Any", + "id": 3 + }, + "versionId": { + "type": "int64", + "id": 4 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "buildId": { + "type": "string", + "id": 6 + } + } + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "java_multiple_files": true, + "java_outer_classname": "ResourceProto", + "java_package": "com.google.api", + "objc_class_prefix": "GAPI", + "cc_enable_arenas": true + }, + "nested": { + "http": { + "type": "HttpRule", + "id": 72295728, + "extend": "google.protobuf.MethodOptions" + }, + "Http": { + "fields": { + "rules": { + "rule": "repeated", + "type": "HttpRule", + "id": 1 + }, + "fullyDecodeReservedExpansion": { + "type": "bool", + "id": 2 + } + } + }, + "HttpRule": { + "oneofs": { + "pattern": { + "oneof": [ + "get", + "put", + "post", + "delete", + "patch", + "custom" + ] + } + }, + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "get": { + "type": "string", + "id": 2 + }, + "put": { + "type": "string", + "id": 3 + }, + "post": { + "type": "string", + "id": 4 + }, + "delete": { + "type": "string", + "id": 5 + }, + "patch": { + "type": "string", + "id": 6 + }, + "custom": { + "type": "CustomHttpPattern", + "id": 8 + }, + "body": { + "type": "string", + "id": 7 + }, + "responseBody": { + "type": "string", + "id": 12 + }, + "additionalBindings": { + "rule": "repeated", + "type": "HttpRule", + "id": 11 + } + } + }, + "CustomHttpPattern": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" + }, + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions" + }, + "FieldBehavior": { + "values": { + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5 + } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + } + } + }, + "protobuf": { + "options": { + "go_package": "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "csharp_namespace": "Google.Protobuf.Reflection", + "objc_class_prefix": "GPB", + "cc_enable_arenas": true, + "optimize_for": "SPEED" + }, + "nested": { + "FileDescriptorSet": { + "fields": { + "file": { + "rule": "repeated", + "type": "FileDescriptorProto", + "id": 1 + } + } + }, + "FileDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "package": { + "type": "string", + "id": 2 + }, + "dependency": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "publicDependency": { + "rule": "repeated", + "type": "int32", + "id": 10, + "options": { + "packed": false + } + }, + "weakDependency": { + "rule": "repeated", + "type": "int32", + "id": 11, + "options": { + "packed": false + } + }, + "messageType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 4 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 5 + }, + "service": { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "id": 6 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 7 + }, + "options": { + "type": "FileOptions", + "id": 8 + }, + "sourceCodeInfo": { + "type": "SourceCodeInfo", + "id": 9 + }, + "syntax": { + "type": "string", + "id": 12 + } + } + }, + "DescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "field": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 2 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 6 + }, + "nestedType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 3 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 4 + }, + "extensionRange": { + "rule": "repeated", + "type": "ExtensionRange", + "id": 5 + }, + "oneofDecl": { + "rule": "repeated", + "type": "OneofDescriptorProto", + "id": 8 + }, + "options": { + "type": "MessageOptions", + "id": 7 + }, + "reservedRange": { + "rule": "repeated", + "type": "ReservedRange", + "id": 9 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 10 + } + }, + "nested": { + "ExtensionRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "ExtensionRangeOptions", + "id": 3 + } + } + }, + "ReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "ExtensionRangeOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "FieldDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 3 + }, + "label": { + "type": "Label", + "id": 4 + }, + "type": { + "type": "Type", + "id": 5 + }, + "typeName": { + "type": "string", + "id": 6 + }, + "extendee": { + "type": "string", + "id": 2 + }, + "defaultValue": { + "type": "string", + "id": 7 + }, + "oneofIndex": { + "type": "int32", + "id": 9 + }, + "jsonName": { + "type": "string", + "id": 10 + }, + "options": { + "type": "FieldOptions", + "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18 + } + }, + "Label": { + "values": { + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3 + } + } + } + }, + "OneofDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "options": { + "type": "OneofOptions", + "id": 2 + } + } + }, + "EnumDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "id": 2 + }, + "options": { + "type": "EnumOptions", + "id": 3 + }, + "reservedRange": { + "rule": "repeated", + "type": "EnumReservedRange", + "id": 4 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 5 + } + }, + "nested": { + "EnumReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "EnumValueDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "EnumValueOptions", + "id": 3 + } + } + }, + "ServiceDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "method": { + "rule": "repeated", + "type": "MethodDescriptorProto", + "id": 2 + }, + "options": { + "type": "ServiceOptions", + "id": 3 + } + } + }, + "MethodDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "inputType": { + "type": "string", + "id": 2 + }, + "outputType": { + "type": "string", + "id": 3 + }, + "options": { + "type": "MethodOptions", + "id": 4 + }, + "clientStreaming": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "serverStreaming": { + "type": "bool", + "id": 6, + "options": { + "default": false + } + } + } + }, + "FileOptions": { + "fields": { + "javaPackage": { + "type": "string", + "id": 1 + }, + "javaOuterClassname": { + "type": "string", + "id": 8 + }, + "javaMultipleFiles": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "javaGenerateEqualsAndHash": { + "type": "bool", + "id": 20, + "options": { + "deprecated": true + } + }, + "javaStringCheckUtf8": { + "type": "bool", + "id": 27, + "options": { + "default": false + } + }, + "optimizeFor": { + "type": "OptimizeMode", + "id": 9, + "options": { + "default": "SPEED" + } + }, + "goPackage": { + "type": "string", + "id": 11 + }, + "ccGenericServices": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "javaGenericServices": { + "type": "bool", + "id": 17, + "options": { + "default": false + } + }, + "pyGenericServices": { + "type": "bool", + "id": 18, + "options": { + "default": false + } + }, + "phpGenericServices": { + "type": "bool", + "id": 42, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 23, + "options": { + "default": false + } + }, + "ccEnableArenas": { + "type": "bool", + "id": 31, + "options": { + "default": true + } + }, + "objcClassPrefix": { + "type": "string", + "id": 36 + }, + "csharpNamespace": { + "type": "string", + "id": 37 + }, + "swiftPrefix": { + "type": "string", + "id": 39 + }, + "phpClassPrefix": { + "type": "string", + "id": 40 + }, + "phpNamespace": { + "type": "string", + "id": 41 + }, + "phpMetadataNamespace": { + "type": "string", + "id": 44 + }, + "rubyPackage": { + "type": "string", + "id": 45 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 38, + 38 + ] + ], + "nested": { + "OptimizeMode": { + "values": { + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3 + } + } + } + }, + "MessageOptions": { + "fields": { + "messageSetWireFormat": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "noStandardDescriptorAccessor": { + "type": "bool", + "id": 2, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "mapEntry": { + "type": "bool", + "id": 7 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 8, + 8 + ], + [ + 9, + 9 + ] + ] + }, + "FieldOptions": { + "fields": { + "ctype": { + "type": "CType", + "id": 1, + "options": { + "default": "STRING" + } + }, + "packed": { + "type": "bool", + "id": 2 + }, + "jstype": { + "type": "JSType", + "id": 6, + "options": { + "default": "JS_NORMAL" + } + }, + "lazy": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "weak": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ] + ], + "nested": { + "CType": { + "values": { + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2 + } + }, + "JSType": { + "values": { + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2 + } + } + } + }, + "OneofOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "EnumOptions": { + "fields": { + "allowAlias": { + "type": "bool", + "id": 2 + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 5, + 5 + ] + ] + }, + "EnumValueOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "ServiceOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "MethodOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "idempotencyLevel": { + "type": "IdempotencyLevel", + "id": 34, + "options": { + "default": "IDEMPOTENCY_UNKNOWN" + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "IdempotencyLevel": { + "values": { + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2 + } + } + } + }, + "UninterpretedOption": { + "fields": { + "name": { + "rule": "repeated", + "type": "NamePart", + "id": 2 + }, + "identifierValue": { + "type": "string", + "id": 3 + }, + "positiveIntValue": { + "type": "uint64", + "id": 4 + }, + "negativeIntValue": { + "type": "int64", + "id": 5 + }, + "doubleValue": { + "type": "double", + "id": 6 + }, + "stringValue": { + "type": "bytes", + "id": 7 + }, + "aggregateValue": { + "type": "string", + "id": 8 + } + }, + "nested": { + "NamePart": { + "fields": { + "namePart": { + "rule": "required", + "type": "string", + "id": 1 + }, + "isExtension": { + "rule": "required", + "type": "bool", + "id": 2 + } + } + } + } + }, + "SourceCodeInfo": { + "fields": { + "location": { + "rule": "repeated", + "type": "Location", + "id": 1 + } + }, + "nested": { + "Location": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "span": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "leadingComments": { + "type": "string", + "id": 3 + }, + "trailingComments": { + "type": "string", + "id": 4 + }, + "leadingDetachedComments": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + } + } + }, + "GeneratedCodeInfo": { + "fields": { + "annotation": { + "rule": "repeated", + "type": "Annotation", + "id": 1 + } + }, + "nested": { + "Annotation": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "sourceFile": { + "type": "string", + "id": 2 + }, + "begin": { + "type": "int32", + "id": 3 + }, + "end": { + "type": "int32", + "id": 4 + } + } + } + } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Empty": { + "fields": {} + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "iam": { + "nested": { + "v1": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.Cloud.Iam.V1", + "go_package": "google.golang.org/genproto/googleapis/iam/v1;iam", + "java_multiple_files": true, + "java_outer_classname": "PolicyProto", + "java_package": "com.google.iam.v1", + "php_namespace": "Google\\Cloud\\Iam\\V1" + }, + "nested": { + "IAMPolicy": { + "options": { + "(google.api.default_host)": "iam-meta-api.googleapis.com" + }, + "methods": { + "SetIamPolicy": { + "requestType": "SetIamPolicyRequest", + "responseType": "Policy", + "options": { + "(google.api.http).post": "/v1/{resource=**}:setIamPolicy", + "(google.api.http).body": "*" + } + }, + "GetIamPolicy": { + "requestType": "GetIamPolicyRequest", + "responseType": "Policy", + "options": { + "(google.api.http).post": "/v1/{resource=**}:getIamPolicy", + "(google.api.http).body": "*" + } + }, + "TestIamPermissions": { + "requestType": "TestIamPermissionsRequest", + "responseType": "TestIamPermissionsResponse", + "options": { + "(google.api.http).post": "/v1/{resource=**}:testIamPermissions", + "(google.api.http).body": "*" + } + } + } + }, + "SetIamPolicyRequest": { + "fields": { + "resource": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "policy": { + "type": "Policy", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetIamPolicyRequest": { + "fields": { + "resource": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "options": { + "type": "GetPolicyOptions", + "id": 2 + } + } + }, + "TestIamPermissionsRequest": { + "fields": { + "resource": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "permissions": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "TestIamPermissionsResponse": { + "fields": { + "permissions": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "GetPolicyOptions": { + "fields": { + "requestedPolicyVersion": { + "type": "int32", + "id": 1 + } + } + }, + "Policy": { + "fields": { + "version": { + "type": "int32", + "id": 1 + }, + "bindings": { + "rule": "repeated", + "type": "Binding", + "id": 4 + }, + "etag": { + "type": "bytes", + "id": 3 + } + } + }, + "Binding": { + "fields": { + "role": { + "type": "string", + "id": 1 + }, + "members": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "condition": { + "type": "google.type.Expr", + "id": 3 + } + } + }, + "PolicyDelta": { + "fields": { + "bindingDeltas": { + "rule": "repeated", + "type": "BindingDelta", + "id": 1 + }, + "auditConfigDeltas": { + "rule": "repeated", + "type": "AuditConfigDelta", + "id": 2 + } + } + }, + "BindingDelta": { + "fields": { + "action": { + "type": "Action", + "id": 1 + }, + "role": { + "type": "string", + "id": 2 + }, + "member": { + "type": "string", + "id": 3 + }, + "condition": { + "type": "google.type.Expr", + "id": 4 + } + }, + "nested": { + "Action": { + "values": { + "ACTION_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2 + } + } + } + }, + "AuditConfigDelta": { + "fields": { + "action": { + "type": "Action", + "id": 1 + }, + "service": { + "type": "string", + "id": 2 + }, + "exemptedMember": { + "type": "string", + "id": 3 + }, + "logType": { + "type": "string", + "id": 4 + } + }, + "nested": { + "Action": { + "values": { + "ACTION_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2 + } + } + } + } + } + } + } + }, + "type": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/type/expr;expr", + "java_multiple_files": true, + "java_outer_classname": "ExprProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP" + }, + "nested": { + "Expr": { + "fields": { + "expression": { + "type": "string", + "id": 1 + }, + "title": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + }, + "location": { + "type": "string", + "id": 4 + } + } + } + } + }, + "longrunning": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.LongRunning", + "go_package": "google.golang.org/genproto/googleapis/longrunning;longrunning", + "java_multiple_files": true, + "java_outer_classname": "OperationsProto", + "java_package": "com.google.longrunning", + "php_namespace": "Google\\LongRunning" + }, + "nested": { + "operationInfo": { + "type": "google.longrunning.OperationInfo", + "id": 1049, + "extend": "google.protobuf.MethodOptions" + }, + "Operations": { + "options": { + "(google.api.default_host)": "longrunning.googleapis.com" + }, + "methods": { + "ListOperations": { + "requestType": "ListOperationsRequest", + "responseType": "ListOperationsResponse", + "options": { + "(google.api.http).get": "/v1/{name=operations}", + "(google.api.method_signature)": "name,filter" + } + }, + "GetOperation": { + "requestType": "GetOperationRequest", + "responseType": "Operation", + "options": { + "(google.api.http).get": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + } + }, + "DeleteOperation": { + "requestType": "DeleteOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + } + }, + "CancelOperation": { + "requestType": "CancelOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1/{name=operations/**}:cancel", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + } + }, + "WaitOperation": { + "requestType": "WaitOperationRequest", + "responseType": "Operation" + } + } + }, + "Operation": { + "oneofs": { + "result": { + "oneof": [ + "error", + "response" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "metadata": { + "type": "google.protobuf.Any", + "id": 2 + }, + "done": { + "type": "bool", + "id": 3 + }, + "error": { + "type": "google.rpc.Status", + "id": 4 + }, + "response": { + "type": "google.protobuf.Any", + "id": 5 + } + } + }, + "GetOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "ListOperationsRequest": { + "fields": { + "name": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 1 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListOperationsResponse": { + "fields": { + "operations": { + "rule": "repeated", + "type": "Operation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CancelOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "DeleteOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "WaitOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 2 + } + } + }, + "OperationInfo": { + "fields": { + "responseType": { + "type": "string", + "id": 1 + }, + "metadataType": { + "type": "string", + "id": 2 + } + } + } + } + }, + "rpc": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", + "java_multiple_files": true, + "java_outer_classname": "StatusProto", + "java_package": "com.google.rpc", + "objc_class_prefix": "RPC" + }, + "nested": { + "Status": { + "fields": { + "code": { + "type": "int32", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "details": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-functions/src/index.ts b/packages/google-cloud-functions/src/index.ts new file mode 100644 index 00000000000..885e9604269 --- /dev/null +++ b/packages/google-cloud-functions/src/index.ts @@ -0,0 +1,26 @@ +// 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. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; + +const CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; + +export {v1, CloudFunctionsServiceClient}; +export default {v1, CloudFunctionsServiceClient}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts new file mode 100644 index 00000000000..ba5d5821789 --- /dev/null +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -0,0 +1,1425 @@ +// 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. +// +// ** 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 {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import * as path from 'path'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import * as gapicConfig from './cloud_functions_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * A service that application uses to manipulate triggers and functions. + * @class + * @memberof v1 + */ +export class CloudFunctionsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}, batching: {}}; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + cloudFunctionsServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudFunctionsServiceClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof CloudFunctionsServiceClient; + const servicePath = opts && opts.servicePath ? + opts.servicePath : + ((opts && opts.apiEndpoint) ? opts.apiEndpoint : + staticMembers.servicePath); + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + + // users can override the config from client side, like retry codes name. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 + // The way to override client config for Showcase API: + // + // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} + // const showcaseClient = new showcaseClient({ projectId, customConfig }); + opts.clientConfig = opts.clientConfig || {}; + + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the CloudFunctionsServiceClient constructor. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof CloudFunctionsServiceClient).scopes; + 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); + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json'); + this._protos = this._gaxGrpc.loadProto( + opts.fallback ? + // eslint-disable-next-line @typescript-eslint/no-var-requires + require("../../protos/protos.json") : + nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cloudFunctionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + 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 = { + listFunctions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') + }; + + // 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 protoFilesRoot = opts.fallback ? + this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require("../../protos/protos.json")) : + this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v1.CloudFunction') as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v1.CloudFunction') as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata)), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata)), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v1.CloudFunctionsService', 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 = {}; + } + + /** + * 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.cloudFunctionsServiceStub) { + return this.cloudFunctionsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v1.CloudFunctionsService. + this.cloudFunctionsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.functions.v1.CloudFunctionsService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v1.CloudFunctionsService, + this._opts) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const cloudFunctionsServiceStubMethods = + ['listFunctions', 'getFunction', 'createFunction', 'updateFunction', 'deleteFunction', 'callFunction', 'generateUploadUrl', 'generateDownloadUrl', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions']; + for (const methodName of cloudFunctionsServiceStubMethods) { + const callPromise = this.cloudFunctionsServiceStub.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 apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudFunctionsServiceStub; + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getFunction( + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|undefined, {}|undefined + ]>; + getFunction( + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; + getFunction( + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Returns a function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getFunction( + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFunction(request, options, callback); + } + callFunction( + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|undefined, {}|undefined + ]>; + callFunction( + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, + {}|null|undefined>): void; + callFunction( + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, + {}|null|undefined>): void; +/** + * Synchronously invokes a deployed Cloud Function. To be used for testing + * purposes as very limited traffic is allowed. For more information on + * the actual limits, refer to + * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function to be called. + * @param {string} request.data + * Required. Input to be passed to the 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 an object representing [CallFunctionResponse]{@link google.cloud.functions.v1.CallFunctionResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + callFunction( + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.callFunction(request, options, callback); + } + generateUploadUrl( + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|undefined, {}|undefined + ]>; + generateUploadUrl( + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateUploadUrl( + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): void; +/** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * Source file size should not exceed 100MB limit. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * * `x-goog-content-length-range: 0,104857600` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v1.GenerateUploadUrlResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + generateUploadUrl( + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.generateUploadUrl(request, options, callback); + } + generateDownloadUrl( + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|undefined, {}|undefined + ]>; + generateDownloadUrl( + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): void; +/** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * minutes after generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @param {number} request.versionId + * The optional version of function. If not set, default, current version + * is used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v1.GenerateDownloadUrlResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + generateDownloadUrl( + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.generateDownloadUrl(request, options, callback); + } + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: gax.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; +/** + * Sets the IAM access control policy on the specified function. + * Replaces any existing policy. + * + * @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 [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: gax.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: 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' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: gax.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; +/** + * Gets the IAM access control policy for a function. + * Returns an empty policy if the function 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 {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 [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: gax.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: 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' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: gax.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; +/** + * Tests the specified permissions against the IAM access control policy + * for a function. + * If the function does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: gax.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: 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' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } + + createFunction( + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + options?: gax.CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createFunction( + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + options: gax.CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createFunction( + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.location + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + * @param {google.cloud.functions.v1.CloudFunction} request.function + * Required. Function to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createFunction( + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + optionsOrCallback?: gax.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: 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' + ] = gax.routingHeader.fromParams({ + 'location': request.location || '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by the createFunction() method. + * @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. + * + * @example: + * const decodedOperation = await checkCreateFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkCreateFunctionProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createFunction, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + updateFunction( + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + options?: gax.CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateFunction( + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + options: gax.CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateFunction( + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v1.CloudFunction} request.function + * Required. New version of the function. + * @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 [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateFunction( + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + optionsOrCallback?: gax.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: 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' + ] = gax.routingHeader.fromParams({ + 'function.name': request.function!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by the updateFunction() method. + * @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. + * + * @example: + * const decodedOperation = await checkUpdateFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkUpdateFunctionProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateFunction, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + deleteFunction( + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + options?: gax.CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteFunction( + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + options: gax.CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteFunction( + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; +/** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should 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 [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteFunction( + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + optionsOrCallback?: gax.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: 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } +/** + * Check the status of the long running operation returned by the deleteFunction() method. + * @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. + * + * @example: + * const decodedOperation = await checkDeleteFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkDeleteFunctionProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteFunction, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + listFunctions( + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.functions.v1.ICloudFunction[], + protos.google.cloud.functions.v1.IListFunctionsRequest|null, + protos.google.cloud.functions.v1.IListFunctionsResponse + ]>; + listFunctions( + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v1.ICloudFunction>): void; + listFunctions( + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v1.ICloudFunction>): void; +/** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of 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 Array of [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [CloudFunction]{@link google.cloud.functions.v1.CloudFunction} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListFunctionsRequest]{@link google.cloud.functions.v1.ListFunctionsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListFunctionsResponse]{@link google.cloud.functions.v1.ListFunctionsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listFunctions( + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v1.ICloudFunction>, + callback?: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, + protos.google.cloud.functions.v1.ICloudFunction>): + Promise<[ + protos.google.cloud.functions.v1.ICloudFunction[], + protos.google.cloud.functions.v1.IListFunctionsRequest|null, + protos.google.cloud.functions.v1.IListFunctionsResponse + ]>|void { + request = request || {}; + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFunctions(request, options, callback); + } + +/** + * Equivalent to {@link listFunctions}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listFunctions} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @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 [CloudFunction]{@link google.cloud.functions.v1.CloudFunction} on 'data' event. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + options?: gax.CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to {@link listFunctions}, but 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.parent + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + options?: gax.CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cloudFunction resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} function + * @returns {string} Resource name string. + */ + cloudFunctionPath(project:string,location:string,function:string) { + return this.pathTemplates.cloudFunctionPathTemplate.render({ + project: project, + location: location, + function: function, + }); + } + + /** + * Parse the project from CloudFunction resource. + * + * @param {string} cloudFunctionName + * A fully-qualified path representing CloudFunction resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCloudFunctionName(cloudFunctionName: string) { + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).project; + } + + /** + * Parse the location from CloudFunction resource. + * + * @param {string} cloudFunctionName + * A fully-qualified path representing CloudFunction resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCloudFunctionName(cloudFunctionName: string) { + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).location; + } + + /** + * Parse the function from CloudFunction resource. + * + * @param {string} cloudFunctionName + * A fully-qualified path representing CloudFunction resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromCloudFunctionName(cloudFunctionName: string) { + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).function; + } + + /** + * 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. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.cloudFunctionsServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json b/packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json new file mode 100644 index 00000000000..99264b00496 --- /dev/null +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json @@ -0,0 +1,70 @@ +{ + "interfaces": { + "google.cloud.functions.v1.CloudFunctionsService": { + "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": { + "ListFunctions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CallFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_proto_list.json b/packages/google-cloud-functions/src/v1/cloud_functions_service_proto_list.json new file mode 100644 index 00000000000..26c6fb8d3dd --- /dev/null +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/functions/v1/functions.proto", + "../../protos/google/cloud/functions/v1/operations.proto" +] diff --git a/packages/google-cloud-functions/src/v1/index.ts b/packages/google-cloud-functions/src/v1/index.ts new file mode 100644 index 00000000000..581ee4368d9 --- /dev/null +++ b/packages/google-cloud-functions/src/v1/index.ts @@ -0,0 +1,19 @@ +// 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. +// +// ** 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 {CloudFunctionsServiceClient} from './cloud_functions_service_client'; diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata new file mode 100644 index 00000000000..c4e659eab1d --- /dev/null +++ b/packages/google-cloud-functions/synth.metadata @@ -0,0 +1,37 @@ +{ + "sources": [ + { + "git": { + "name": ".", + "remote": "git@github.com:googleapis/nodejs-functions.git", + "sha": "1eb6d4effedd8077b1ad45c2bf3d006b50cc4e31" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "e26e1839a45445d13cd45b1be3b1523defb72fee", + "internalRef": "322867095" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "2686d7075fa456972bf4d08680d99617f5eb32b1" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "functions", + "apiVersion": "v1", + "language": "nodejs", + "generator": "bazel" + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..da7f1ab2bf5 --- /dev/null +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. +// +// ** 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 functions = require('@google-cloud/functions'); + +function main() { + const cloudFunctionsServiceClient = new functions.CloudFunctionsServiceClient(); +} + +main(); diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..7870bd5b378 --- /dev/null +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,25 @@ +// 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. +// +// ** 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 {CloudFunctionsServiceClient} from '@google-cloud/functions'; + +function main() { + new CloudFunctionsServiceClient(); +} + +main(); diff --git a/packages/google-cloud-functions/system-test/install.ts b/packages/google-cloud-functions/system-test/install.ts new file mode 100644 index 00000000000..5e4ed636481 --- /dev/null +++ b/packages/google-cloud-functions/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. +// +// ** 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('typescript consumer tests', () => { + + it('should have correct type signature for typescript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); // will throw upon error. + }); + + it('should have correct type signature for javascript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); // will throw upon error. + }); + +}); diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts new file mode 100644 index 00000000000..ab99ab83d98 --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -0,0 +1,1516 @@ +// 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. +// +// ** 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 cloudfunctionsserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +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('v1.CloudFunctionsServiceClient', () => { + it('has servicePath', () => { + const servicePath = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFunctionsServiceStub, undefined); + await client.initialize(); + assert(client.cloudFunctionsServiceStub); + }); + + it('has close method', () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GetFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GetFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()); + client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.ICloudFunction|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getFunction with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GetFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFunction(request), expectedError); + assert((client.innerApiCalls.getFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('callFunction', () => { + it('invokes callFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionResponse()); + client.innerApiCalls.callFunction = stubSimpleCall(expectedResponse); + const [response] = await client.callFunction(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.callFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes callFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionResponse()); + client.innerApiCalls.callFunction = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.callFunction( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.ICallFunctionResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.callFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes callFunction with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.callFunction = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.callFunction(request), expectedError); + assert((client.innerApiCalls.callFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlResponse()); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlResponse()); + client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.IGenerateUploadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateUploadUrl(request), expectedError); + assert((client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse()); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse()); + client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + assert((client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.CreateFunctionRequest()); + request.location = ''; + const expectedHeaderRequestParams = "location="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.CreateFunctionRequest()); + request.location = ''; + const expectedHeaderRequestParams = "location="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + 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); + assert((client.innerApiCalls.createFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.CreateFunctionRequest()); + request.location = ''; + const expectedHeaderRequestParams = "location="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createFunction(request), expectedError); + assert((client.innerApiCalls.createFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.CreateFunctionRequest()); + request.location = ''; + const expectedHeaderRequestParams = "location="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkCreateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.UpdateFunctionRequest()); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = "function.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.UpdateFunctionRequest()); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = "function.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + 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); + assert((client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.UpdateFunctionRequest()); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = "function.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateFunction(request), expectedError); + assert((client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.UpdateFunctionRequest()); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = "function.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkUpdateFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.DeleteFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.DeleteFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + 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); + assert((client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.DeleteFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteFunction(request), expectedError); + assert((client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.DeleteFunctionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkDeleteFunctionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + (err?: Error|null, result?: protos.google.cloud.functions.v1.ICloudFunction[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listFunctions with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFunctions(request), expectedError); + assert((client.innerApiCalls.listFunctions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + ]; + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; + stream.on('data', (response: protos.google.cloud.functions.v1.CloudFunction) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert.strictEqual( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; + stream.on('data', (response: protos.google.cloud.functions.v1.CloudFunction) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); + assert.strictEqual( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), + ]; + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('cloudFunction', () => { + const fakePath = "/rendered/path/cloudFunction"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + function: "functionValue", + }; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cloudFunctionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cloudFunctionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cloudFunctionPath', () => { + const result = client.cloudFunctionPath("projectValue", "locationValue", "functionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cloudFunctionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCloudFunctionName', () => { + const result = client.matchProjectFromCloudFunctionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCloudFunctionName', () => { + const result = client.matchLocationFromCloudFunctionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFunctionFromCloudFunctionName', () => { + const result = client.matchFunctionFromCloudFunctionName(fakePath); + assert.strictEqual(result, "functionValue"); + assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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/packages/google-cloud-functions/tsconfig.json b/packages/google-cloud-functions/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/packages/google-cloud-functions/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/packages/google-cloud-functions/webpack.config.js b/packages/google-cloud-functions/webpack.config.js new file mode 100644 index 00000000000..34037822f59 --- /dev/null +++ b/packages/google-cloud-functions/webpack.config.js @@ -0,0 +1,64 @@ +// 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'CloudFunctionsService', + filename: './cloud-functions-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', +}; From 61f9d38fbae040bb3a3bfcc946639f8e024f9839 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 12:32:15 -0700 Subject: [PATCH 003/123] feat: run synthtool --- .../__pycache__/synth.cpython-37.pyc | Bin 783 -> 783 bytes .../src/v1/cloud_functions_service_client.ts | 1884 +++++---- .../google-cloud-functions/synth.metadata | 6 +- .../system-test/fixtures/sample/src/index.js | 1 - .../system-test/install.ts | 32 +- .../test/gapic_cloud_functions_service_v1.ts | 3444 ++++++++++------- .../google-cloud-functions/webpack.config.js | 12 +- 7 files changed, 3168 insertions(+), 2211 deletions(-) diff --git a/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc b/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc index 81cd26378c1d7717a70a796681ae6f60f80e8b31..a25748733f52e93cb5eb063d75c749e46f06b249 100644 GIT binary patch delta 20 ZcmeBY>u2M3;^pOH0D>Gd>5beh%m5@h0~`PV delta 20 ZcmeBY>u2M3;^pOH0D>e*sg2w$%m5=n0`vd? diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index ba5d5821789..c197b3ba2b9 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -17,14 +17,22 @@ // ** All changes to this file may be overwritten. ** import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; import * as path from 'path'; -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import * as gapicConfig from './cloud_functions_service_client_config.json'; -import { operationsProtos } from 'google-gax'; +import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -40,7 +48,12 @@ export class CloudFunctionsServiceClient { private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}, batching: {}}; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -74,11 +87,14 @@ export class CloudFunctionsServiceClient { constructor(opts?: ClientOptions) { // Ensure that options include the service address and port. - const staticMembers = this.constructor as typeof CloudFunctionsServiceClient; - const servicePath = opts && opts.servicePath ? - opts.servicePath : - ((opts && opts.apiEndpoint) ? opts.apiEndpoint : - staticMembers.servicePath); + const staticMembers = this + .constructor as typeof CloudFunctionsServiceClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; const port = opts && opts.port ? opts.port : staticMembers.port; if (!opts) { @@ -103,20 +119,18 @@ export class CloudFunctionsServiceClient { // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. - opts.scopes = (this.constructor as typeof CloudFunctionsServiceClient).scopes; + opts.scopes = (this + .constructor as typeof CloudFunctionsServiceClient).scopes; 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); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -132,12 +146,18 @@ export class CloudFunctionsServiceClient { // For Node.js, pass the path to JSON proto file. // For browsers, pass the JSON content. - const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json'); + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); this._protos = this._gaxGrpc.loadProto( - opts.fallback ? - // eslint-disable-next-line @typescript-eslint/no-var-requires - require("../../protos/protos.json") : - nodejsProtoPath + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated @@ -156,55 +176,73 @@ export class CloudFunctionsServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listFunctions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'functions') + listFunctions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'functions' + ), }; // 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 protoFilesRoot = opts.fallback ? - this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require("../../protos/protos.json")) : - this._gaxModule.protobuf.loadSync(nodejsProtoPath); + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); const createFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v1.CloudFunction') as gax.protobuf.Type; + '.google.cloud.functions.v1.CloudFunction' + ) as gax.protobuf.Type; const createFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + '.google.cloud.functions.v1.OperationMetadataV1' + ) as gax.protobuf.Type; const updateFunctionResponse = protoFilesRoot.lookup( - '.google.cloud.functions.v1.CloudFunction') as gax.protobuf.Type; + '.google.cloud.functions.v1.CloudFunction' + ) as gax.protobuf.Type; const updateFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + '.google.cloud.functions.v1.OperationMetadataV1' + ) as gax.protobuf.Type; const deleteFunctionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty' + ) as gax.protobuf.Type; const deleteFunctionMetadata = protoFilesRoot.lookup( - '.google.cloud.functions.v1.OperationMetadataV1') as gax.protobuf.Type; + '.google.cloud.functions.v1.OperationMetadataV1' + ) as gax.protobuf.Type; this.descriptors.longrunning = { createFunction: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createFunctionResponse.decode.bind(createFunctionResponse), - createFunctionMetadata.decode.bind(createFunctionMetadata)), + createFunctionMetadata.decode.bind(createFunctionMetadata) + ), updateFunction: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateFunctionResponse.decode.bind(updateFunctionResponse), - updateFunctionMetadata.decode.bind(updateFunctionMetadata)), + updateFunctionMetadata.decode.bind(updateFunctionMetadata) + ), deleteFunction: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteFunctionResponse.decode.bind(deleteFunctionResponse), - deleteFunctionMetadata.decode.bind(deleteFunctionMetadata)) + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata) + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.functions.v1.CloudFunctionsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.functions.v1.CloudFunctionsService', + 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 @@ -232,16 +270,30 @@ export class CloudFunctionsServiceClient { // Put together the "service stub" for // google.cloud.functions.v1.CloudFunctionsService. this.cloudFunctionsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.functions.v1.CloudFunctionsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.functions.v1.CloudFunctionsService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.functions.v1.CloudFunctionsService, - this._opts) as Promise<{[method: string]: Function}>; + this._opts + ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const cloudFunctionsServiceStubMethods = - ['listFunctions', 'getFunction', 'createFunction', 'updateFunction', 'deleteFunction', 'callFunction', 'generateUploadUrl', 'generateDownloadUrl', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions']; + const cloudFunctionsServiceStubMethods = [ + 'listFunctions', + 'getFunction', + 'createFunction', + 'updateFunction', + 'deleteFunction', + 'callFunction', + 'generateUploadUrl', + 'generateDownloadUrl', + 'setIamPolicy', + 'getIamPolicy', + 'testIamPermissions', + ]; for (const methodName of cloudFunctionsServiceStubMethods) { const callPromise = this.cloudFunctionsServiceStub.then( stub => (...args: Array<{}>) => { @@ -251,16 +303,17 @@ export class CloudFunctionsServiceClient { const func = stub[methodName]; return func.apply(stub, args); }, - (err: Error|null|undefined) => () => { + (err: Error | null | undefined) => () => { throw err; - }); + } + ); const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] ); this.innerApiCalls[methodName] = apiCall; @@ -296,9 +349,7 @@ export class CloudFunctionsServiceClient { * in this service. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -308,8 +359,9 @@ export class CloudFunctionsServiceClient { * @param {function(Error, string)} callback - the callback to * be called with the current project Id. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -321,59 +373,74 @@ export class CloudFunctionsServiceClient { // -- Service calls -- // ------------------- getFunction( - request: protos.google.cloud.functions.v1.IGetFunctionRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest | undefined, + {} | undefined + ] + >; getFunction( - request: protos.google.cloud.functions.v1.IGetFunctionRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): void; getFunction( - request: protos.google.cloud.functions.v1.IGetFunctionRequest, - callback: Callback< - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Returns a function with the given name from the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which details should be obtained. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Returns a function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getFunction( - request: protos.google.cloud.functions.v1.IGetFunctionRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v1.ICloudFunction, - protos.google.cloud.functions.v1.IGetFunctionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.functions.v1.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -382,70 +449,85 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); return this.innerApiCalls.getFunction(request, options, callback); } callFunction( - request: protos.google.cloud.functions.v1.ICallFunctionRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest | undefined, + {} | undefined + ] + >; callFunction( - request: protos.google.cloud.functions.v1.ICallFunctionRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest | null | undefined, + {} | null | undefined + > + ): void; callFunction( - request: protos.google.cloud.functions.v1.ICallFunctionRequest, - callback: Callback< - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, - {}|null|undefined>): void; -/** - * Synchronously invokes a deployed Cloud Function. To be used for testing - * purposes as very limited traffic is allowed. For more information on - * the actual limits, refer to - * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function to be called. - * @param {string} request.data - * Required. Input to be passed to the 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 an object representing [CallFunctionResponse]{@link google.cloud.functions.v1.CallFunctionResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Synchronously invokes a deployed Cloud Function. To be used for testing + * purposes as very limited traffic is allowed. For more information on + * the actual limits, refer to + * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function to be called. + * @param {string} request.data + * Required. Input to be passed to the 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 an object representing [CallFunctionResponse]{@link google.cloud.functions.v1.CallFunctionResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ callFunction( - request: protos.google.cloud.functions.v1.ICallFunctionRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v1.ICallFunctionResponse, - protos.google.cloud.functions.v1.ICallFunctionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.functions.v1.ICallFunctionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -454,90 +536,111 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); return this.innerApiCalls.callFunction(request, options, callback); } generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | undefined, + {} | undefined + ] + >; generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): void; -/** - * Returns a signed URL for uploading a function source code. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls. - * Once the function source code upload is complete, the used signed - * URL should be provided in CreateFunction or UpdateFunction request - * as a reference to the function source code. - * - * When uploading source code to the generated signed URL, please follow - * these restrictions: - * - * * Source file type should be a zip file. - * * Source file size should not exceed 100MB limit. - * * No credentials should be attached - the signed URLs provide access to the - * target bucket using internal service identity; if credentials were - * attached, the identity from the credentials would be used, but that - * identity does not have permissions to upload files to the URL. - * - * When making a HTTP PUT request, these two headers need to be specified: - * - * * `content-type: application/zip` - * * `x-goog-content-length-range: 0,104857600` - * - * And this header SHOULD NOT be specified: - * - * * `Authorization: Bearer YOUR_TOKEN` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The project and location in which the Google Cloud Storage signed URL - * should be generated, specified in the format `projects/* /locations/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v1.GenerateUploadUrlResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * Source file size should not exceed 100MB limit. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * * `x-goog-content-length-range: 0,104857600` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v1.GenerateUploadUrlResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -546,73 +649,94 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', + parent: request.parent || '', }); this.initialize(); return this.innerApiCalls.generateUploadUrl(request, options, callback); } generateDownloadUrl( - request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | undefined, + {} | undefined + ] + >; generateDownloadUrl( - request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; generateDownloadUrl( - request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): void; -/** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * minutes after generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * @param {number} request.versionId - * The optional version of function. If not set, default, current version - * is used. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v1.GenerateDownloadUrlResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * minutes after generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @param {number} request.versionId + * The optional version of function. If not set, default, current version + * is used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v1.GenerateDownloadUrlResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ generateDownloadUrl( - request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, - protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -621,72 +745,85 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); return this.innerApiCalls.generateDownloadUrl(request, options, callback); } setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; + request: protos.google.iam.v1.ISetIamPolicyRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + ] + >; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: gax.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; -/** - * Sets the IAM access control policy on the specified function. - * Replaces any existing policy. - * - * @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 [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Sets the IAM access control policy on the specified function. + * Replaces any existing policy. + * + * @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 [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: + | gax.CallOptions + | 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 { + 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: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -695,71 +832,84 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', + resource: request.resource || '', }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; + request: protos.google.iam.v1.IGetIamPolicyRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + ] + >; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: gax.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; -/** - * Gets the IAM access control policy for a function. - * Returns an empty policy if the function 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 {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 [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Gets the IAM access control policy for a function. + * Returns an empty policy if the function 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 {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 [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: gax.CallOptions|Callback< + request: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: + | gax.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 { + 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: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -768,74 +918,87 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', + resource: request.resource || '', }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + ] + >; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: gax.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; -/** - * Tests the specified permissions against the IAM access control policy - * for a function. - * If the function does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Tests the specified permissions against the IAM access control policy + * for a function. + * If the function does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: gax.CallOptions|Callback< + request: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: + | gax.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 { + 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: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -844,71 +1007,102 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', + resource: request.resource || '', }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); } createFunction( - request: protos.google.cloud.functions.v1.ICreateFunctionRequest, - options?: gax.CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; createFunction( - request: protos.google.cloud.functions.v1.ICreateFunctionRequest, - options: gax.CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; createFunction( - request: protos.google.cloud.functions.v1.ICreateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.location - * Required. The project and location in which the function should be created, specified - * in the format `projects/* /locations/*` - * @param {google.cloud.functions.v1.CloudFunction} request.function - * Required. Function to be created. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.location + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + * @param {google.cloud.functions.v1.CloudFunction} request.function + * Required. Function to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ createFunction( - request: protos.google.cloud.functions.v1.ICreateFunctionRequest, - optionsOrCallback?: gax.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: protos.google.cloud.functions.v1.ICreateFunctionRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -917,87 +1111,134 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'location': request.location || '', + location: request.location || '', }); this.initialize(); return this.innerApiCalls.createFunction(request, options, callback); } -/** - * Check the status of the long running operation returned by the createFunction() method. - * @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. - * - * @example: - * const decodedOperation = await checkCreateFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * - */ - async checkCreateFunctionProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by the createFunction() method. + * @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. + * + * @example: + * const decodedOperation = await checkCreateFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkCreateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v1.CloudFunction, + protos.google.cloud.functions.v1.OperationMetadataV1 + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createFunction, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v1.CloudFunction, + protos.google.cloud.functions.v1.OperationMetadataV1 + >; } updateFunction( - request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - options?: gax.CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; updateFunction( - request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - options: gax.CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; updateFunction( - request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Updates existing function. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.functions.v1.CloudFunction} request.function - * Required. New version of the function. - * @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 [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v1.CloudFunction} request.function + * Required. New version of the function. + * @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 [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ updateFunction( - request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - optionsOrCallback?: gax.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: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -1011,82 +1252,129 @@ export class CloudFunctionsServiceClient { this.initialize(); return this.innerApiCalls.updateFunction(request, options, callback); } -/** - * Check the status of the long running operation returned by the updateFunction() method. - * @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. - * - * @example: - * const decodedOperation = await checkUpdateFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * - */ - async checkUpdateFunctionProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by the updateFunction() method. + * @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. + * + * @example: + * const decodedOperation = await checkUpdateFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkUpdateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v1.CloudFunction, + protos.google.cloud.functions.v1.OperationMetadataV1 + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateFunction, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v1.CloudFunction, + protos.google.cloud.functions.v1.OperationMetadataV1 + >; } deleteFunction( - request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - options?: gax.CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; deleteFunction( - request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - options: gax.CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; deleteFunction( - request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; -/** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which should 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 [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should 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 [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ deleteFunction( - request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - optionsOrCallback?: gax.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: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -1095,111 +1383,146 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); return this.innerApiCalls.deleteFunction(request, options, callback); } -/** - * Check the status of the long running operation returned by the deleteFunction() method. - * @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. - * - * @example: - * const decodedOperation = await checkDeleteFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * - */ - async checkDeleteFunctionProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + /** + * Check the status of the long running operation returned by the deleteFunction() method. + * @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. + * + * @example: + * const decodedOperation = await checkDeleteFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + * + */ + async checkDeleteFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v1.OperationMetadataV1 + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteFunction, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v1.OperationMetadataV1 + >; } listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.functions.v1.ICloudFunction[], - protos.google.cloud.functions.v1.IListFunctionsRequest|null, - protos.google.cloud.functions.v1.IListFunctionsResponse - ]>; + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.functions.v1.ICloudFunction[], + protos.google.cloud.functions.v1.IListFunctionsRequest | null, + protos.google.cloud.functions.v1.IListFunctionsResponse + ] + >; listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v1.ICloudFunction>): void; + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + | protos.google.cloud.functions.v1.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v1.ICloudFunction + > + ): void; listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, - callback: PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v1.ICloudFunction>): void; -/** - * Returns a list of functions that belong to the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The project and location from which the function should be listed, - * specified in the format `projects/* /locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of 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 Array of [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. - * The client library support 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. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [CloudFunction]{@link google.cloud.functions.v1.CloudFunction} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListFunctionsRequest]{@link google.cloud.functions.v1.ListFunctionsRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListFunctionsResponse]{@link google.cloud.functions.v1.ListFunctionsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + | protos.google.cloud.functions.v1.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v1.ICloudFunction + > + ): void; + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of 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 Array of [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. + * The client library support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [CloudFunction]{@link google.cloud.functions.v1.CloudFunction} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListFunctionsRequest]{@link google.cloud.functions.v1.ListFunctionsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListFunctionsResponse]{@link google.cloud.functions.v1.ListFunctionsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, - optionsOrCallback?: gax.CallOptions|PaginationCallback< + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + optionsOrCallback?: + | gax.CallOptions + | PaginationCallback< protos.google.cloud.functions.v1.IListFunctionsRequest, - protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v1.ICloudFunction>, - callback?: PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - protos.google.cloud.functions.v1.IListFunctionsResponse|null|undefined, - protos.google.cloud.functions.v1.ICloudFunction>): - Promise<[ - protos.google.cloud.functions.v1.ICloudFunction[], - protos.google.cloud.functions.v1.IListFunctionsRequest|null, - protos.google.cloud.functions.v1.IListFunctionsResponse - ]>|void { + | protos.google.cloud.functions.v1.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v1.ICloudFunction + >, + callback?: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + | protos.google.cloud.functions.v1.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v1.ICloudFunction + > + ): Promise< + [ + protos.google.cloud.functions.v1.ICloudFunction[], + protos.google.cloud.functions.v1.IListFunctionsRequest | null, + protos.google.cloud.functions.v1.IListFunctionsResponse + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -1208,50 +1531,50 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', + parent: request.parent || '', }); this.initialize(); return this.innerApiCalls.listFunctions(request, options, callback); } -/** - * Equivalent to {@link listFunctions}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listFunctions} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The project and location from which the function should be listed, - * specified in the format `projects/* /locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @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 [CloudFunction]{@link google.cloud.functions.v1.CloudFunction} on 'data' event. - */ + /** + * Equivalent to {@link listFunctions}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listFunctions} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @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 [CloudFunction]{@link google.cloud.functions.v1.CloudFunction} on 'data' event. + */ listFunctionsStream( - request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - options?: gax.CallOptions): - Transform{ + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + options?: gax.CallOptions + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1259,7 +1582,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', + parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); this.initialize(); @@ -1270,36 +1593,36 @@ export class CloudFunctionsServiceClient { ); } -/** - * Equivalent to {@link listFunctions}, but 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.parent - * The project and location from which the function should be listed, - * specified in the format `projects/* /locations/*` - * If you want to list functions in all locations, use "-" in place of a - * location. When listing functions in all locations, if one or more - * location(s) are unreachable, the response will contain functions from all - * reachable locations along with the names of any unreachable locations. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * The value returned by the last - * `ListFunctionsResponse`; indicates that - * this is a continuation of a prior `ListFunctions` call, and that the - * system should return the next page of data. - * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ + /** + * Equivalent to {@link listFunctions}, but 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.parent + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listFunctionsAsync( - request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - options?: gax.CallOptions): - AsyncIterable{ + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + options?: gax.CallOptions + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1307,14 +1630,14 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', + parent: request.parent || '', }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listFunctions.asyncIterate( this.innerApiCalls['listFunctions'] as GaxCall, - request as unknown as RequestType, + (request as unknown) as RequestType, callSettings ) as AsyncIterable; } @@ -1330,11 +1653,11 @@ export class CloudFunctionsServiceClient { * @param {string} function * @returns {string} Resource name string. */ - cloudFunctionPath(project:string,location:string,function:string) { + cloudFunctionPath(project: string, location: string, function_: string) { return this.pathTemplates.cloudFunctionPathTemplate.render({ project: project, location: location, - function: function, + function: function_, }); } @@ -1346,7 +1669,8 @@ export class CloudFunctionsServiceClient { * @returns {string} A string representing the project. */ matchProjectFromCloudFunctionName(cloudFunctionName: string) { - return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).project; + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName) + .project; } /** @@ -1357,7 +1681,8 @@ export class CloudFunctionsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromCloudFunctionName(cloudFunctionName: string) { - return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).location; + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName) + .location; } /** @@ -1368,7 +1693,8 @@ export class CloudFunctionsServiceClient { * @returns {string} A string representing the function. */ matchFunctionFromCloudFunctionName(cloudFunctionName: string) { - return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName).function; + return this.pathTemplates.cloudFunctionPathTemplate.match(cloudFunctionName) + .function; } /** @@ -1378,7 +1704,7 @@ export class CloudFunctionsServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index c4e659eab1d..df32b1eaab3 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "git@github.com:googleapis/nodejs-functions.git", - "sha": "1eb6d4effedd8077b1ad45c2bf3d006b50cc4e31" + "sha": "5798802a7686e4569bfe28142e304efcffd15c4c" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "e26e1839a45445d13cd45b1be3b1523defb72fee", - "internalRef": "322867095" + "sha": "e0ba04a01ce13922ace5c362d9226c55eb88bcde", + "internalRef": "323039149" } }, { diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js index da7f1ab2bf5..7a7e29b3535 100644 --- a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js @@ -16,7 +16,6 @@ // ** 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 functions = require('@google-cloud/functions'); diff --git a/packages/google-cloud-functions/system-test/install.ts b/packages/google-cloud-functions/system-test/install.ts index 5e4ed636481..4c1ba3eb79a 100644 --- a/packages/google-cloud-functions/system-test/install.ts +++ b/packages/google-cloud-functions/system-test/install.ts @@ -16,34 +16,36 @@ // ** 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'; +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; describe('typescript consumer tests', () => { - - it('should have correct type signature for typescript users', async function() { + it('should have correct type signature for typescript users', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), // path to your module. sample: { description: 'typescript based user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); // will throw upon error. }); - it('should have correct type signature for javascript users', async function() { + it('should have correct type signature for javascript users', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), // path to your module. sample: { description: 'typescript based user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); // will throw upon error. }); - }); diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index ab99ab83d98..917fe191335 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -20,7 +20,7 @@ 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 {describe, it} from 'mocha'; import * as cloudfunctionsserviceModule from '../src'; import {PassThrough} from 'stream'; @@ -28,1489 +28,2119 @@ import {PassThrough} from 'stream'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; 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; + 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]); + 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 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 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 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]); - } +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(); }); + } + 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({}); + }); } - return sinon.stub().returns(mockStream); + 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); +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.CloudFunctionsServiceClient', () => { - it('has servicePath', () => { - const servicePath = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.servicePath; - assert(servicePath); + it('has servicePath', () => { + const servicePath = + cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.cloudFunctionsServiceStub, undefined); + await client.initialize(); + assert(client.cloudFunctionsServiceStub); + }); + + it('has close method', () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + 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); + } + }); }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.apiEndpoint; - assert(apiEndpoint); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - it('has port', () => { - const port = cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('invokes getFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ); + client.innerApiCalls.getFunction = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v1.ICloudFunction | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - it('should create a client with no option', () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); - assert(client); + it('invokes getFunction with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getFunction(request), expectedError); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - fallback: true, - }); - assert(client); + }); + + describe('callFunction', () => { + it('invokes callFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionResponse() + ); + client.innerApiCalls.callFunction = stubSimpleCall(expectedResponse); + const [response] = await client.callFunction(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.callFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudFunctionsServiceStub, undefined); - await client.initialize(); - assert(client.cloudFunctionsServiceStub); + it('invokes callFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionResponse() + ); + client.innerApiCalls.callFunction = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.callFunction( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v1.ICallFunctionResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.callFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - it('has close method', () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.close(); + it('invokes callFunction with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.callFunction = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.callFunction(request), expectedError); + assert( + (client.innerApiCalls.callFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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()); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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); + it('invokes generateUploadUrl without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v1.IGenerateUploadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('getFunction', () => { - it('invokes getFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GetFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()); - client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); - const [response] = await client.getFunction(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GetFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()); - client.innerApiCalls.getFunction = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFunction( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.ICloudFunction|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getFunction with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GetFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getFunction = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFunction(request), expectedError); - assert((client.innerApiCalls.getFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes generateUploadUrl with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateUploadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - - describe('callFunction', () => { - it('invokes callFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionResponse()); - client.innerApiCalls.callFunction = stubSimpleCall(expectedResponse); - const [response] = await client.callFunction(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.callFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes callFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionResponse()); - client.innerApiCalls.callFunction = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.callFunction( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.ICallFunctionResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.callFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes callFunction with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.CallFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.callFunction = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.callFunction(request), expectedError); - assert((client.innerApiCalls.callFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall( + expectedResponse + ); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - describe('generateUploadUrl', () => { - it('invokes generateUploadUrl without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlResponse()); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateUploadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes generateUploadUrl without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlResponse()); - client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateUploadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.IGenerateUploadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes generateUploadUrl with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateUploadUrlRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.generateUploadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateUploadUrl(request), expectedError); - assert((client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('generateDownloadUrl', () => { - it('invokes generateDownloadUrl without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse()); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateDownloadUrl(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes generateDownloadUrl without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse()); - client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateDownloadUrl( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes generateDownloadUrl with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateDownloadUrl(request), expectedError); - assert((client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes generateDownloadUrl with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes testIamPermissions with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('createFunction', () => { - it('invokes createFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.CreateFunctionRequest()); - request.location = ''; - const expectedHeaderRequestParams = "location="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.createFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCall( + expectedResponse + ); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes createFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.CreateFunctionRequest()); - request.location = ''; - const expectedHeaderRequestParams = "location="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFunction( - 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); - assert((client.innerApiCalls.createFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes createFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.CreateFunctionRequest()); - request.location = ''; - const expectedHeaderRequestParams = "location="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createFunction(request), expectedError); - assert((client.innerApiCalls.createFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes testIamPermissions with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CreateFunctionRequest() + ); + request.location = ''; + const expectedHeaderRequestParams = 'location='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes createFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.CreateFunctionRequest()); - request.location = ''; - const expectedHeaderRequestParams = "location="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createFunction(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes createFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CreateFunctionRequest() + ); + request.location = ''; + const expectedHeaderRequestParams = 'location='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes checkCreateFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - 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.checkCreateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CreateFunctionRequest() + ); + request.location = ''; + const expectedHeaderRequestParams = 'location='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createFunction(request), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes checkCreateFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CreateFunctionRequest() + ); + request.location = ''; + const expectedHeaderRequestParams = 'location='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - describe('updateFunction', () => { - it('invokes updateFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.UpdateFunctionRequest()); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = "function.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + 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.checkCreateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.UpdateFunctionRequest()); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = "function.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFunction( - 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); - assert((client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkCreateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes updateFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.UpdateFunctionRequest()); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = "function.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateFunction(request), expectedError); - assert((client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes updateFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes updateFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.UpdateFunctionRequest()); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = "function.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateFunction(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes updateFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateFunction(request), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes checkUpdateFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - 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.checkUpdateFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes checkUpdateFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + 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.checkUpdateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteFunction', () => { - it('invokes deleteFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.DeleteFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteFunction = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteFunction(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkUpdateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes deleteFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.DeleteFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFunction( - 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); - assert((client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes deleteFunction without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v1.IOperationMetadataV1 + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v1.IOperationMetadataV1 + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes deleteFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.DeleteFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteFunction(request), expectedError); - assert((client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes deleteFunction with call error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteFunction(request), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes deleteFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.DeleteFunctionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFunction = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteFunction(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes deleteFunction with LRO error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes checkDeleteFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - 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.checkDeleteFunctionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + 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.checkDeleteFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteFunctionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkDeleteFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - describe('listFunctions', () => { - it('invokes listFunctions without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); - const [response] = await client.listFunctions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes listFunctions without error using callback', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + ]; + client.innerApiCalls.listFunctions = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v1.ICloudFunction[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes listFunctions without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - ]; - client.innerApiCalls.listFunctions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFunctions( - request, - (err?: Error|null, result?: protos.google.cloud.functions.v1.ICloudFunction[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes listFunctions with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listFunctions(request), expectedError); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes listFunctions with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listFunctions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFunctions(request), expectedError); - assert((client.innerApiCalls.listFunctions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + it('invokes listFunctionsStream without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + ]; + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v1.CloudFunction) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listFunctionsStream without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - ]; - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; - stream.on('data', (response: protos.google.cloud.functions.v1.CloudFunction) => { - 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.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert.strictEqual( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + (client.descriptors.page.listFunctions + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); - it('invokes listFunctionsStream with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFunctionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; - stream.on('data', (response: protos.google.cloud.functions.v1.CloudFunction) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFunctions, request)); - assert.strictEqual( - (client.descriptors.page.listFunctions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + it('invokes listFunctionsStream with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v1.CloudFunction) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listFunctions without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - generateSampleMessage(new protos.google.cloud.functions.v1.CloudFunction()), - ]; - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; - const iterable = client.listFunctionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + (client.descriptors.page.listFunctions + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); - it('uses async iteration with listFunctions with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.functions.v1.ListFunctionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFunctionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listFunctions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + it('uses async iteration with listFunctions without error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + generateSampleMessage( + new protos.google.cloud.functions.v1.CloudFunction() + ), + ]; + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listFunctions + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); }); - describe('Path templates', () => { - - describe('cloudFunction', () => { - const fakePath = "/rendered/path/cloudFunction"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - function: "functionValue", - }; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cloudFunctionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cloudFunctionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cloudFunctionPath', () => { - const result = client.cloudFunctionPath("projectValue", "locationValue", "functionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cloudFunctionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCloudFunctionName', () => { - const result = client.matchProjectFromCloudFunctionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCloudFunctionName', () => { - const result = client.matchLocationFromCloudFunctionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFunctionFromCloudFunctionName', () => { - const result = client.matchFunctionFromCloudFunctionName(fakePath); - assert.strictEqual(result, "functionValue"); - assert((client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listFunctions with error', async () => { + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFunctions + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listFunctions + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('cloudFunction', () => { + const fakePath = '/rendered/path/cloudFunction'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + function: 'functionValue', + }; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.cloudFunctionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cloudFunctionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cloudFunctionPath', () => { + const result = client.cloudFunctionPath( + 'projectValue', + 'locationValue', + 'functionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cloudFunctionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCloudFunctionName', () => { + const result = client.matchProjectFromCloudFunctionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCloudFunctionName', () => { + const result = client.matchLocationFromCloudFunctionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFunctionFromCloudFunctionName', () => { + const result = client.matchFunctionFromCloudFunctionName(fakePath); + assert.strictEqual(result, 'functionValue'); + assert( + (client.pathTemplates.cloudFunctionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - 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('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + 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/packages/google-cloud-functions/webpack.config.js b/packages/google-cloud-functions/webpack.config.js index 34037822f59..51f8b4714eb 100644 --- a/packages/google-cloud-functions/webpack.config.js +++ b/packages/google-cloud-functions/webpack.config.js @@ -36,27 +36,27 @@ module.exports = { { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]grpc/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]retry-request/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]gtoken/, - use: 'null-loader' + use: 'null-loader', }, ], }, From f2ef7887f91dc66b8b50032812c01f3ff1356a19 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 12:39:28 -0700 Subject: [PATCH 004/123] initial stub of synthtool --- .../__pycache__/synth.cpython-37.pyc | Bin 783 -> 812 bytes packages/google-cloud-functions/package.json | 2 ++ .../samples/quickstart.js | 0 packages/google-cloud-functions/synth.py | 2 +- 4 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 packages/google-cloud-functions/samples/quickstart.js diff --git a/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc b/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc index a25748733f52e93cb5eb063d75c749e46f06b249..53fcb86f5a2271f9a8108bad4825fa093c63d8f6 100644 GIT binary patch delta 152 zcmeBYTf@fd#LLUY00cM9rQ^R(rFSu2&#g&|fcN+6YYfnX|ss=z{~DE?HY zETL5X6!sL3bfy%}i3>zExl&lu8BPu8RY8d;_IrHn^MJ7keHmEn4YSaRh*x<*^%)GBbOKx2O|q39}ofn2RkIT delta 139 zcmZ3(*3ZW4#LLUY00cQ^((!jD@=7vpny4NXtCq^=!VoJLC6LOyKrod*RbU}g6n`pH zmQX5xIztM3FB2m}VN5tfD$4@lg$z+5sUlf|DI6)R>5M6?DV)8`QKDeAqA<0o> Date: Fri, 24 Jul 2020 12:55:12 -0700 Subject: [PATCH 005/123] feat!: initial generation of full library --- .../samples/quickstart.js | 45 +++++++++++++++++++ .../samples/test/quickstart.test.js | 39 ++++++++++++++++ .../google-cloud-functions/synth.metadata | 4 +- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-functions/samples/test/quickstart.test.js diff --git a/packages/google-cloud-functions/samples/quickstart.js b/packages/google-cloud-functions/samples/quickstart.js index e69de29bb2d..87edbddb6ae 100644 --- a/packages/google-cloud-functions/samples/quickstart.js +++ b/packages/google-cloud-functions/samples/quickstart.js @@ -0,0 +1,45 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +'use strict'; + +async function main( + project = 'my-project/*/locations/*', // Get the functions for a project. + page_size = 1 //Max number of functions to return per call +) { + // [START cloud_nodejs_functions_quickstart] + // Imports the Google Cloud client library + const {AnalyticsAdminServiceClient} = require('@google-analytics/admin'); + + // Creates a client + const client = new AnalyticsAdminServiceClient(); + + // name = 'my-name' // Get an account for a name. + async function getAccount() { + const [account] = await client.getAccount({ + name, + }); + console.info(account); + } + getAccount(); + // [END cloud_nodejs_functions_quickstart] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); \ No newline at end of file diff --git a/packages/google-cloud-functions/samples/test/quickstart.test.js b/packages/google-cloud-functions/samples/test/quickstart.test.js new file mode 100644 index 00000000000..51c8f7bb6dd --- /dev/null +++ b/packages/google-cloud-functions/samples/test/quickstart.test.js @@ -0,0 +1,39 @@ + +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +const path = require('path'); +const {assert} = require('chai'); +const cp = require('child_process'); +const {describe, it} = require('mocha'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const cwd = path.join(__dirname, '..'); + +const project = process.env.GCLOUD_PROJECT; + +describe('Quickstart', () => { + it('should run quickstart', async () => { + const stdout = execSync(node ./quickstart.js ${project}, {cwd}); + assert.match(stdout, /found [0-9]+ deployments/); + }); +}); + + diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index df32b1eaab3..b4f6c3fcb4f 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "git@github.com:googleapis/nodejs-functions.git", - "sha": "5798802a7686e4569bfe28142e304efcffd15c4c" + "sha": "ab972c4a19a0dd87a7a1610ba9f0f7344923a24f" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "2686d7075fa456972bf4d08680d99617f5eb32b1" + "sha": "a6643f6f27fc70e2c63c90944bb900c709022e57" } } ], From b0c9a86327c1271452066bfe596e3a5d314ad872 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 13:37:21 -0700 Subject: [PATCH 006/123] feat: stub out samples directory --- .../samples/package.json | 21 ++++++++++++++++ .../samples/quickstart.js | 25 +++++++++++-------- .../samples/test/quickstart.test.js | 9 ++++--- 3 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 packages/google-cloud-functions/samples/package.json diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json new file mode 100644 index 00000000000..601cd40c5b5 --- /dev/null +++ b/packages/google-cloud-functions/samples/package.json @@ -0,0 +1,21 @@ +{ + "name": "nodejs-cloud-functions", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=10" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "c8 mocha --timeout 600000 test/*.js" + }, + "dependencies": {}, + "devDependencies": { + "c8": "^7.1.0", + "chai": "^4.2.0", + "mocha": "^7.1.0" + } +} diff --git a/packages/google-cloud-functions/samples/quickstart.js b/packages/google-cloud-functions/samples/quickstart.js index 87edbddb6ae..45015f5a4b0 100644 --- a/packages/google-cloud-functions/samples/quickstart.js +++ b/packages/google-cloud-functions/samples/quickstart.js @@ -14,24 +14,27 @@ 'use strict'; async function main( - project = 'my-project/*/locations/*', // Get the functions for a project. - page_size = 1 //Max number of functions to return per call + project = 'projects/my-project/locations/-', // Get the functions for a project. + page_size = 1, //Max number of functions to return per call + page_token = 'token' ) { // [START cloud_nodejs_functions_quickstart] // Imports the Google Cloud client library - const {AnalyticsAdminServiceClient} = require('@google-analytics/admin'); + const {CloudFunctionsServiceClient} = require('@google-cloud/functions'); // Creates a client - const client = new AnalyticsAdminServiceClient(); + const client = new CloudFunctionsServiceClient(); - // name = 'my-name' // Get an account for a name. - async function getAccount() { - const [account] = await client.getAccount({ - name, + // project = 'my-project/*/locations/*' // Get the functions for a project. + async function listFunctions() { + const [functions] = await client.listFunctions({ + parent: project, + pageSize: page_size, + pageToken: page_token, }); - console.info(account); + console.info(functions); } - getAccount(); + listFunctions(); // [END cloud_nodejs_functions_quickstart] } @@ -42,4 +45,4 @@ main(...process.argv.slice(2)).catch(err => { process.on('unhandledRejection', err => { console.error(err.message); process.exitCode = 1; -}); \ No newline at end of file +}); diff --git a/packages/google-cloud-functions/samples/test/quickstart.test.js b/packages/google-cloud-functions/samples/test/quickstart.test.js index 51c8f7bb6dd..9af4fc4099a 100644 --- a/packages/google-cloud-functions/samples/test/quickstart.test.js +++ b/packages/google-cloud-functions/samples/test/quickstart.test.js @@ -31,9 +31,10 @@ const project = process.env.GCLOUD_PROJECT; describe('Quickstart', () => { it('should run quickstart', async () => { - const stdout = execSync(node ./quickstart.js ${project}, {cwd}); - assert.match(stdout, /found [0-9]+ deployments/); + const stdout = execSync( + `node ./quickstart.js projects/${project}/locations/- 1 token`, + {cwd} + ); + assert(stdout, stdout !== null); }); }); - - From 01338715f0178472802c6e97aea233e0ad881583 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 13:40:34 -0700 Subject: [PATCH 007/123] chore: make library beta --- packages/google-cloud-functions/.repo-metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json index be436fb8111..8365f8e245e 100644 --- a/packages/google-cloud-functions/.repo-metadata.json +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://developers.google.com/nodejs-functions/", "client_documentation": "https://googleapis.dev/nodejs/nodejs-functions/latest/index.html", "issue_tracker": "", - "release_level": "alpha", + "release_level": "beta", "language": "nodejs", "repo": "googleapis/nodejs-functions", "distribution_name": "@google-cloud/functions", From d28be00342be1ce4537a6e24ccab0930ed2ac320 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 16:13:41 -0700 Subject: [PATCH 008/123] fix: linting errors --- packages/google-cloud-functions/README.md | 45 ++++++++++++++--- .../linkinator.config.json | 5 +- .../google-cloud-functions/samples/README.md | 50 +++++++++++++++++++ .../samples/package.json | 2 +- .../samples/test/quickstart.test.js | 1 - .../google-cloud-functions/synth.metadata | 6 +-- 6 files changed, 97 insertions(+), 12 deletions(-) create mode 100644 packages/google-cloud-functions/samples/README.md diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index d7d089aa35c..8ba1e4cd2b4 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -4,7 +4,7 @@ # [Google Cloud Functions: Node.js Client](https://github.com/googleapis/nodejs-functions) -[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/functions.svg)](https://www.npmjs.org/package/@google-cloud/functions) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-functions/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-functions) @@ -29,8 +29,8 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. * [Quickstart](#quickstart) * [Before you begin](#before-you-begin) * [Installing the client library](#installing-the-client-library) - - + * [Using the client library](#using-the-client-library) +* [Samples](#samples) * [Versioning](#versioning) * [Contributing](#contributing) * [License](#license) @@ -51,6 +51,38 @@ npm install @google-cloud/functions ``` +### Using the client library + +```javascript +// Imports the Google Cloud client library +const {CloudFunctionsServiceClient} = require('@google-cloud/functions'); + +// Creates a client +const client = new CloudFunctionsServiceClient(); + +// project = 'my-project/*/locations/*' // Get the functions for a project. +async function listFunctions() { + const [functions] = await client.listFunctions({ + parent: project, + pageSize: page_size, + pageToken: page_token, + }); + console.info(functions); +} +listFunctions(); + +``` + + + +## Samples + +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-functions/tree/master/samples) directory. The samples' `README.md` +has instructions for running the samples. + +| Sample | Source Code | Try it | +| --------------------------- | --------------------------------- | ------ | +| Quickstart | [source code](https://github.com/googleapis/nodejs-functions/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-functions&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | @@ -84,10 +116,11 @@ This library follows [Semantic Versioning](http://semver.org/). +This library is considered to be in **beta**. This means it is expected to be +mostly stable while we work toward a general availability release; however, +complete stability is not guaranteed. We will address issues and requests +against beta libraries with a high priority. -This library is considered to be in **alpha**. This means it is still a -work-in-progress and under active development. Any release is subject to -backwards-incompatible changes at any time. diff --git a/packages/google-cloud-functions/linkinator.config.json b/packages/google-cloud-functions/linkinator.config.json index 29a223b6db6..1b974a86010 100644 --- a/packages/google-cloud-functions/linkinator.config.json +++ b/packages/google-cloud-functions/linkinator.config.json @@ -3,7 +3,10 @@ "skip": [ "https://codecov.io/gh/googleapis/", "www.googleapis.com", - "img.shields.io" + "img.shields.io", + "https://googleapis.dev/nodejs/nodejs-functions/latest/index.html", + "https://github.com/googleapis/nodejs-functions/tree/master/samples", + "https://developers.google.com/nodejs-functions/" ], "silent": true, "concurrency": 10 diff --git a/packages/google-cloud-functions/samples/README.md b/packages/google-cloud-functions/samples/README.md new file mode 100644 index 00000000000..4979fa3754b --- /dev/null +++ b/packages/google-cloud-functions/samples/README.md @@ -0,0 +1,50 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Google Cloud Functions: Node.js Samples](https://github.com/googleapis/nodejs-functions) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [Quickstart](#quickstart) + +## Before you begin + +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/nodejs-functions#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### Quickstart + +View the [source code](https://github.com/googleapis/nodejs-functions/blob/master/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-functions&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node samples/quickstart.js` + + + + + + +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-functions&page=editor&open_in_editor=samples/README.md +[product-docs]: https://developers.google.com/nodejs-functions/ diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 601cd40c5b5..2b1ae00c76a 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -10,7 +10,7 @@ "*.js" ], "scripts": { - "test": "c8 mocha --timeout 600000 test/*.js" + "test": "npm link ../; c8 mocha --timeout 600000 test/*.js" }, "dependencies": {}, "devDependencies": { diff --git a/packages/google-cloud-functions/samples/test/quickstart.test.js b/packages/google-cloud-functions/samples/test/quickstart.test.js index 9af4fc4099a..fb85b9c8b9e 100644 --- a/packages/google-cloud-functions/samples/test/quickstart.test.js +++ b/packages/google-cloud-functions/samples/test/quickstart.test.js @@ -1,4 +1,3 @@ - // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index b4f6c3fcb4f..f7c56d0fb70 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "git@github.com:googleapis/nodejs-functions.git", - "sha": "ab972c4a19a0dd87a7a1610ba9f0f7344923a24f" + "sha": "7813cbfd5b4193073ecb3531542b8f97075500ee" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "e0ba04a01ce13922ace5c362d9226c55eb88bcde", - "internalRef": "323039149" + "sha": "b4fa4f3460ad8102c39bf7e0ad25cab149a9eca5", + "internalRef": "323061919" } }, { From f10d427e2b2e665cb76a8f7384ce873d0b2f0feb Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 16:16:48 -0700 Subject: [PATCH 009/123] fix: add prelint script --- packages/google-cloud-functions/samples/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 2b1ae00c76a..2d97874d42c 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -10,7 +10,8 @@ "*.js" ], "scripts": { - "test": "npm link ../; c8 mocha --timeout 600000 test/*.js" + "prelint": "cd samples; npm link ../; npm install", + "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": {}, "devDependencies": { From 4a8c3bf14be6f1989e27d96ba7998476cc58944b Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 16:38:47 -0700 Subject: [PATCH 010/123] fix: missing require --- packages/google-cloud-functions/samples/package.json | 1 - packages/google-cloud-functions/samples/quickstart.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 2d97874d42c..601cd40c5b5 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -10,7 +10,6 @@ "*.js" ], "scripts": { - "prelint": "cd samples; npm link ../; npm install", "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": {}, diff --git a/packages/google-cloud-functions/samples/quickstart.js b/packages/google-cloud-functions/samples/quickstart.js index 45015f5a4b0..d8fb2fc2098 100644 --- a/packages/google-cloud-functions/samples/quickstart.js +++ b/packages/google-cloud-functions/samples/quickstart.js @@ -20,6 +20,7 @@ async function main( ) { // [START cloud_nodejs_functions_quickstart] // Imports the Google Cloud client library + // eslint-disable-next-line node/no-missing-require const {CloudFunctionsServiceClient} = require('@google-cloud/functions'); // Creates a client From 2ddc207ed262a15307bf52fc7ed27b808ed06c4d Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 16:41:17 -0700 Subject: [PATCH 011/123] fix: linting --- packages/google-cloud-functions/samples/quickstart.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/google-cloud-functions/samples/quickstart.js b/packages/google-cloud-functions/samples/quickstart.js index d8fb2fc2098..c93a6117601 100644 --- a/packages/google-cloud-functions/samples/quickstart.js +++ b/packages/google-cloud-functions/samples/quickstart.js @@ -14,15 +14,21 @@ 'use strict'; async function main( + projectId = 'my-project' project = 'projects/my-project/locations/-', // Get the functions for a project. page_size = 1, //Max number of functions to return per call page_token = 'token' ) { // [START cloud_nodejs_functions_quickstart] // Imports the Google Cloud client library + + // remove this line after package is released // eslint-disable-next-line node/no-missing-require const {CloudFunctionsServiceClient} = require('@google-cloud/functions'); + // TODO(developer): replace with your prefered project ID. + // const projectId = 'my-project' + // Creates a client const client = new CloudFunctionsServiceClient(); From 9bf4d68e5e5b50ec7b4f9efa66f8d9cbb6cbf4a5 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 16:48:38 -0700 Subject: [PATCH 012/123] fix: linting error --- packages/google-cloud-functions/samples/quickstart.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/google-cloud-functions/samples/quickstart.js b/packages/google-cloud-functions/samples/quickstart.js index c93a6117601..c77c4aee573 100644 --- a/packages/google-cloud-functions/samples/quickstart.js +++ b/packages/google-cloud-functions/samples/quickstart.js @@ -14,7 +14,6 @@ 'use strict'; async function main( - projectId = 'my-project' project = 'projects/my-project/locations/-', // Get the functions for a project. page_size = 1, //Max number of functions to return per call page_token = 'token' From 5c67c8e0d18305bd84f08ed842b2812bec151cf4 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 24 Jul 2020 16:48:54 -0700 Subject: [PATCH 013/123] fix: space --- packages/google-cloud-functions/samples/quickstart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/samples/quickstart.js b/packages/google-cloud-functions/samples/quickstart.js index c77c4aee573..4f6eaa29675 100644 --- a/packages/google-cloud-functions/samples/quickstart.js +++ b/packages/google-cloud-functions/samples/quickstart.js @@ -26,7 +26,7 @@ async function main( const {CloudFunctionsServiceClient} = require('@google-cloud/functions'); // TODO(developer): replace with your prefered project ID. - // const projectId = 'my-project' + // const projectId = 'my-project' // Creates a client const client = new CloudFunctionsServiceClient(); From d4b618be7d882b5fe60141adf9fe8d08961e9421 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 24 Jul 2020 23:49:08 +0000 Subject: [PATCH 014/123] chore: created CHANGELOG.md [ci skip] --- packages/google-cloud-functions/CHANGELOG.md | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/google-cloud-functions/CHANGELOG.md diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md new file mode 100644 index 00000000000..7136359b299 --- /dev/null +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -0,0 +1,26 @@ +# Changelog + +## 1.0.0 (2020-07-24) + + +### ⚠ BREAKING CHANGES + +* initial generation of full library + +### Features + +* first library generation ([1eb6d4e](https://www.github.com/googleapis/nodejs-functions/commit/1eb6d4effedd8077b1ad45c2bf3d006b50cc4e31)) +* initial generation of full library ([56dd811](https://www.github.com/googleapis/nodejs-functions/commit/56dd8110379f1f89dab77fb24e857b671b09569b)) +* run synthtool ([d990bc4](https://www.github.com/googleapis/nodejs-functions/commit/d990bc4fe9272fd7389b59a5fc0f248d3e0eb196)) +* run synthtool ([5798802](https://www.github.com/googleapis/nodejs-functions/commit/5798802a7686e4569bfe28142e304efcffd15c4c)) +* stub out samples directory ([32d1b49](https://www.github.com/googleapis/nodejs-functions/commit/32d1b4911e8de58885f77a8da0d124895a3d7a7d)) + + +### Bug Fixes + +* add prelint script ([d110ca0](https://www.github.com/googleapis/nodejs-functions/commit/d110ca0815f6276e24ef0babe40ab9abd7d51b4e)) +* linting ([a6bac6b](https://www.github.com/googleapis/nodejs-functions/commit/a6bac6bbed0ab4c44f6425df4ac2638a9c0c81e0)) +* linting error ([454bf37](https://www.github.com/googleapis/nodejs-functions/commit/454bf373253ce1d0ba081fbba3ee2fd9d76d88a0)) +* linting errors ([8e62b5d](https://www.github.com/googleapis/nodejs-functions/commit/8e62b5d0ce6e8ef91f1b496750a1604b7bb1c4e2)) +* missing require ([6956aa0](https://www.github.com/googleapis/nodejs-functions/commit/6956aa08cc7e00a4db4957f4f78fe485e74a492f)) +* space ([18af745](https://www.github.com/googleapis/nodejs-functions/commit/18af745e130d3cfaf91c28ac64124ffa3afbdb09)) From 1e9536c5a690bb3dc9d5372f1ceb90a7633a42a5 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 24 Jul 2020 23:49:10 +0000 Subject: [PATCH 015/123] chore: updated package.json --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 6412cf7b2b5..3caac774e75 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "0.1.0", + "version": "1.0.0", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", From c9e2a730a46ce86dc9c4df727e8207477878113c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 3 Aug 2020 22:08:16 +0200 Subject: [PATCH 016/123] chore(deps): update dependency mocha to v8 (#4) --- packages/google-cloud-functions/samples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 601cd40c5b5..1e9ac02a9f6 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -16,6 +16,6 @@ "devDependencies": { "c8": "^7.1.0", "chai": "^4.2.0", - "mocha": "^7.1.0" + "mocha": "^8.0.0" } } From b5a38796422d86efa04c7dfdd9e6e9a9f5d37736 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Mon, 3 Aug 2020 13:34:53 -0700 Subject: [PATCH 017/123] fix: run synthtool hack to compile code (#6) * fix: run synthtool hack to compile code * fix: broken docs test Co-authored-by: Benjamin E. Coe --- packages/google-cloud-functions/README.md | 6 ++++++ .../__pycache__/synth.cpython-37.pyc | Bin 812 -> 972 bytes .../linkinator.config.json | 2 -- packages/google-cloud-functions/synth.metadata | 8 ++++---- packages/google-cloud-functions/synth.py | 2 ++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index 8ba1e4cd2b4..eb18bda29ed 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -55,8 +55,14 @@ npm install @google-cloud/functions ```javascript // Imports the Google Cloud client library + +// remove this line after package is released +// eslint-disable-next-line node/no-missing-require const {CloudFunctionsServiceClient} = require('@google-cloud/functions'); +// TODO(developer): replace with your prefered project ID. +// const projectId = 'my-project' + // Creates a client const client = new CloudFunctionsServiceClient(); diff --git a/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc b/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc index 53fcb86f5a2271f9a8108bad4825fa093c63d8f6..930a9d579306578c1001cddb9349adbe64155cd3 100644 GIT binary patch delta 240 zcmZ3(c7~nLiIPm-PUMqdyfjgLohH))u@s&Z-W0xt%!~}F5FUSu0GP+V zKztzsBSQ*PFoUMx#776~t2By>lJ(0B^^^COI~KppT09Cm&&QVpN;V&aBG9$H>PB0C2-iwEzGB delta 72 zcmX@ZzJ`s@iIxNV~PI$rh#Vhb4<8B&;n88mq&{yWH|DL&bP b>GxzCW;r%Kpz Date: Mon, 3 Aug 2020 13:48:02 -0700 Subject: [PATCH 018/123] chore: release 1.0.1 (#7) * chore: updated samples/package.json [ci skip] * chore: updated CHANGELOG.md [ci skip] * chore: updated package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 7136359b299..bf0d6a155ba 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.0.1](https://www.github.com/googleapis/nodejs-functions/compare/v1.0.0...v1.0.1) (2020-08-03) + + +### Bug Fixes + +* run synthtool hack to compile code ([#6](https://www.github.com/googleapis/nodejs-functions/issues/6)) ([2b080c5](https://www.github.com/googleapis/nodejs-functions/commit/2b080c5bfd3f134a5e0a365fc0d6663e1dd4755c)) + ## 1.0.0 (2020-07-24) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 3caac774e75..52ab9241393 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.0.0", + "version": "1.0.1", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", From dd177e2679b97159c6bbfcb35e06e81ac6c82bc4 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 12 Aug 2020 21:28:02 -0700 Subject: [PATCH 019/123] chore: update protos (#10) --- packages/google-cloud-functions/linkinator.config.json | 4 ++-- packages/google-cloud-functions/protos/protos.d.ts | 2 +- packages/google-cloud-functions/protos/protos.js | 2 +- packages/google-cloud-functions/synth.metadata | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-functions/linkinator.config.json b/packages/google-cloud-functions/linkinator.config.json index 42e905907f3..5611e3116dc 100644 --- a/packages/google-cloud-functions/linkinator.config.json +++ b/packages/google-cloud-functions/linkinator.config.json @@ -3,8 +3,8 @@ "skip": [ "https://codecov.io/gh/googleapis/", "www.googleapis.com", - "img.shields.io", - "https://developers.google.com/nodejs-functions/" + "https://developers.google.com/nodejs-functions/", + "img.shields.io" ], "silent": true, "concurrency": 10 diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 133208b60cc..224dc217b5d 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import * as Long from "long"; -import * as $protobuf from "protobufjs"; +import {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index db678e84863..5f40406c5c1 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -19,7 +19,7 @@ define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("protobufjs/minimal")); + module.exports = factory(require("google-gax").protobufMinimal); })(this, function($protobuf) { "use strict"; diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index c2b244e2ad0..f5fd88d7f37 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -3,8 +3,8 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-functions.git", - "sha": "fc544c2a6eeef8ee09649aa88f28055de1f036ab" + "remote": "https://github.com/googleapis/nodejs-functions.git", + "sha": "8b706c7fd65e36026215187736d860e3eb31a6fd" } }, { From e7b3a4d23dc05de5e77b58e432a5bf4e4d3b1d1e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 12 Aug 2020 21:36:08 -0700 Subject: [PATCH 020/123] build: use gapic-generator-typescript v1.0.7, use protos (#14) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/5f7f9c6d-c75a-4c60-8bb8-0026a14cead7/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 325949033 Source-Link: https://github.com/googleapis/googleapis/commit/94006b3cb8d2fb44703cf535da15608eed6bf7db --- .../src/v1/cloud_functions_service_client.ts | 8 +++++--- packages/google-cloud-functions/synth.metadata | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index c197b3ba2b9..a4b626bb6d2 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -308,12 +308,14 @@ export class CloudFunctionsServiceClient { } ); + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + descriptor ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index f5fd88d7f37..eb3409b6295 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "546f389d95dbbc88d9d5a00fae25b29d49a0d5b6", - "internalRef": "323436667" + "sha": "94006b3cb8d2fb44703cf535da15608eed6bf7db", + "internalRef": "325949033" } }, { From 970385351f2838d3e6ae3e9704a73cc4341794d8 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Thu, 13 Aug 2020 11:05:23 -0700 Subject: [PATCH 021/123] build: fix wrong link in repo-metadata, ran synthtool (#16) * fix: wrong link * chore: rerun synthttool --- .../google-cloud-functions/.repo-metadata.json | 2 +- packages/google-cloud-functions/README.md | 5 ++++- .../__pycache__/synth.cpython-37.pyc | Bin 972 -> 972 bytes .../linkinator.config.json | 1 - .../google-cloud-functions/protos/protos.d.ts | 2 +- .../google-cloud-functions/protos/protos.js | 2 +- .../google-cloud-functions/samples/README.md | 2 +- packages/google-cloud-functions/synth.metadata | 10 +++++----- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json index 8365f8e245e..7fc36812b0b 100644 --- a/packages/google-cloud-functions/.repo-metadata.json +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -1,7 +1,7 @@ { "name": "nodejs-functions", "name_pretty": "Google Cloud Functions", - "product_documentation": "https://developers.google.com/nodejs-functions/", + "product_documentation": "https://cloud.google.com/functions", "client_documentation": "https://googleapis.dev/nodejs/nodejs-functions/latest/index.html", "issue_tracker": "", "release_level": "beta", diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index eb18bda29ed..9823cbf3730 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -14,6 +14,9 @@ Functions client for Node.js +A comprehensive list of changes in each version may be found in +[the CHANGELOG](https://github.com/googleapis/nodejs-functions/blob/master/CHANGELOG.md). + * [Google Cloud Functions Node.js Client API Reference][client-docs] * [Google Cloud Functions Documentation][product-docs] * [github.com/googleapis/nodejs-functions](https://github.com/googleapis/nodejs-functions) @@ -151,7 +154,7 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-functions/blob/master/LICENSE) [client-docs]: https://googleapis.dev/nodejs/nodejs-functions/latest/index.html -[product-docs]: https://developers.google.com/nodejs-functions/ +[product-docs]: https://cloud.google.com/functions [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 diff --git a/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc b/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc index 930a9d579306578c1001cddb9349adbe64155cd3..20c6d8061d62ff7649331a110615ca0453a9f5bb 100644 GIT binary patch delta 20 acmX@ZeukafiI Date: Thu, 13 Aug 2020 11:17:57 -0700 Subject: [PATCH 022/123] build: update protos (#11) * chore(node): fix kokoro build path for cloud-rad Source-Author: F. Hinkelmann Source-Date: Wed Jul 29 00:28:42 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa Source-Link: https://github.com/googleapis/synthtool/commit/89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa * docs: add links to the CHANGELOG from the README.md for Java and Node Source-Author: Megan Potter <57276408+feywind@users.noreply.github.com> Source-Date: Thu Jul 30 13:21:57 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 5936421202fb53ed4641bcb824017dd393a3dbcc Source-Link: https://github.com/googleapis/synthtool/commit/5936421202fb53ed4641bcb824017dd393a3dbcc Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- packages/google-cloud-functions/protos/protos.d.ts | 2 +- packages/google-cloud-functions/protos/protos.js | 2 +- packages/google-cloud-functions/synth.metadata | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 133208b60cc..224dc217b5d 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import * as Long from "long"; -import * as $protobuf from "protobufjs"; +import {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index db678e84863..5f40406c5c1 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -19,7 +19,7 @@ define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("protobufjs/minimal")); + module.exports = factory(require("google-gax").protobufMinimal); })(this, function($protobuf) { "use strict"; diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 4016c9b9f9f..beea4c26228 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -3,8 +3,8 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-functions.git", - "sha": "f5e68e025b02fc79910d2117f1ac42e952a9ed65" + "remote": "https://github.com/googleapis/nodejs-functions.git", + "sha": "8b706c7fd65e36026215187736d860e3eb31a6fd" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "d3049e66447b44dc10579e461d5e08e0e3838edd" + "sha": "5936421202fb53ed4641bcb824017dd393a3dbcc" } } ], From 4c6ef59d8a685845f5becef4b6de49cf7dabbb09 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 19 Aug 2020 22:08:26 -0700 Subject: [PATCH 023/123] chore: start tracking obsolete files --- .../google-cloud-functions/synth.metadata | 81 ++++++++++++++++++- 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index beea4c26228..170054a2946 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,22 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "8b706c7fd65e36026215187736d860e3eb31a6fd" + "sha": "cbbaff293a30ae954bfd34c998ebe41bd546d216" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "874846a1917ee5c3fe271449f3cb9a06e75407be", - "internalRef": "326288259" + "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", + "internalRef": "327369997" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5936421202fb53ed4641bcb824017dd393a3dbcc" + "sha": "1a60ff2a3975c2f5054431588bd95db9c3b862ba" } } ], @@ -33,5 +33,78 @@ "generator": "bazel" } } + ], + "generatedFiles": [ + ".eslintignore", + ".eslintrc.json", + ".gitattributes", + ".github/ISSUE_TEMPLATE/bug_report.md", + ".github/ISSUE_TEMPLATE/feature_request.md", + ".github/ISSUE_TEMPLATE/support_request.md", + ".github/PULL_REQUEST_TEMPLATE.md", + ".github/publish.yml", + ".github/release-please.yml", + ".github/workflows/ci.yaml", + ".gitignore", + ".jsdoc.js", + ".kokoro/.gitattributes", + ".kokoro/common.cfg", + ".kokoro/continuous/node10/common.cfg", + ".kokoro/continuous/node10/docs.cfg", + ".kokoro/continuous/node10/lint.cfg", + ".kokoro/continuous/node10/samples-test.cfg", + ".kokoro/continuous/node10/system-test.cfg", + ".kokoro/continuous/node10/test.cfg", + ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/test.cfg", + ".kokoro/docs.sh", + ".kokoro/lint.sh", + ".kokoro/populate-secrets.sh", + ".kokoro/presubmit/node10/common.cfg", + ".kokoro/presubmit/node10/samples-test.cfg", + ".kokoro/presubmit/node10/system-test.cfg", + ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/test.cfg", + ".kokoro/publish.sh", + ".kokoro/release/docs-devsite.cfg", + ".kokoro/release/docs-devsite.sh", + ".kokoro/release/docs.cfg", + ".kokoro/release/docs.sh", + ".kokoro/release/publish.cfg", + ".kokoro/samples-test.sh", + ".kokoro/system-test.sh", + ".kokoro/test.bat", + ".kokoro/test.sh", + ".kokoro/trampoline.sh", + ".mocharc.js", + ".nycrc", + ".prettierignore", + ".prettierrc.js", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE", + "README.md", + "api-extractor.json", + "linkinator.config.json", + "package-lock.json.3503827311", + "protos/google/cloud/functions/v1/functions.proto", + "protos/google/cloud/functions/v1/operations.proto", + "protos/protos.d.ts", + "protos/protos.js", + "protos/protos.json", + "renovate.json", + "samples/README.md", + "samples/package-lock.json.3160220455", + "src/index.ts", + "src/v1/cloud_functions_service_client.ts", + "src/v1/cloud_functions_service_client_config.json", + "src/v1/cloud_functions_service_proto_list.json", + "src/v1/index.ts", + "system-test/fixtures/sample/src/index.js", + "system-test/fixtures/sample/src/index.ts", + "system-test/install.ts", + "test/gapic_cloud_functions_service_v1.ts", + "tsconfig.json", + "webpack.config.js" ] } \ No newline at end of file From ec06aa073a755178d3c9412e9ce726f6c7849e8d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 26 Aug 2020 09:21:42 -0700 Subject: [PATCH 024/123] build: move system and samples test from Node 10 to Node 12 (#18) Source-Author: sofisl <55454395+sofisl@users.noreply.github.com> Source-Date: Thu Aug 20 18:29:50 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 05de3e1e14a0b07eab8b474e669164dbd31f81fb Source-Link: https://github.com/googleapis/synthtool/commit/05de3e1e14a0b07eab8b474e669164dbd31f81fb --- packages/google-cloud-functions/synth.metadata | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 170054a2946..83071683eca 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "cbbaff293a30ae954bfd34c998ebe41bd546d216" + "sha": "435ea625489d270cdb7242e649e040c5765eeb5a" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1a60ff2a3975c2f5054431588bd95db9c3b862ba" + "sha": "05de3e1e14a0b07eab8b474e669164dbd31f81fb" } } ], @@ -51,19 +51,19 @@ ".kokoro/common.cfg", ".kokoro/continuous/node10/common.cfg", ".kokoro/continuous/node10/docs.cfg", - ".kokoro/continuous/node10/lint.cfg", - ".kokoro/continuous/node10/samples-test.cfg", - ".kokoro/continuous/node10/system-test.cfg", ".kokoro/continuous/node10/test.cfg", ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/lint.cfg", + ".kokoro/continuous/node12/samples-test.cfg", + ".kokoro/continuous/node12/system-test.cfg", ".kokoro/continuous/node12/test.cfg", ".kokoro/docs.sh", ".kokoro/lint.sh", ".kokoro/populate-secrets.sh", ".kokoro/presubmit/node10/common.cfg", - ".kokoro/presubmit/node10/samples-test.cfg", - ".kokoro/presubmit/node10/system-test.cfg", ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/samples-test.cfg", + ".kokoro/presubmit/node12/system-test.cfg", ".kokoro/presubmit/node12/test.cfg", ".kokoro/publish.sh", ".kokoro/release/docs-devsite.cfg", @@ -86,7 +86,6 @@ "README.md", "api-extractor.json", "linkinator.config.json", - "package-lock.json.3503827311", "protos/google/cloud/functions/v1/functions.proto", "protos/google/cloud/functions/v1/operations.proto", "protos/protos.d.ts", @@ -94,7 +93,6 @@ "protos/protos.json", "renovate.json", "samples/README.md", - "samples/package-lock.json.3160220455", "src/index.ts", "src/v1/cloud_functions_service_client.ts", "src/v1/cloud_functions_service_client_config.json", From c04b5c68430244c70581a3afd7a529b80443837c Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 27 Aug 2020 09:26:30 -0700 Subject: [PATCH 025/123] build: track flaky tests for "nightly", add new secrets for tagging (#20) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/157de3e1-dc75-4d92-b3d9-35d704dfd201/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/8cf6d2834ad14318e64429c3b94f6443ae83daf9 --- packages/google-cloud-functions/synth.metadata | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 83071683eca..c7ad3592c77 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "435ea625489d270cdb7242e649e040c5765eeb5a" + "sha": "3dba59a5e10e040a3b2c96af4b19121061ecb509" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "05de3e1e14a0b07eab8b474e669164dbd31f81fb" + "sha": "8cf6d2834ad14318e64429c3b94f6443ae83daf9" } } ], @@ -42,7 +42,6 @@ ".github/ISSUE_TEMPLATE/feature_request.md", ".github/ISSUE_TEMPLATE/support_request.md", ".github/PULL_REQUEST_TEMPLATE.md", - ".github/publish.yml", ".github/release-please.yml", ".github/workflows/ci.yaml", ".gitignore", From faff5aff14e1d092c9db847949bd404666dc58f1 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 1 Sep 2020 12:16:13 -0700 Subject: [PATCH 026/123] feat: promote library to GA (#22) --- packages/google-cloud-functions/.repo-metadata.json | 2 +- packages/google-cloud-functions/README.md | 11 ++++++----- packages/google-cloud-functions/protos/protos.d.ts | 2 +- packages/google-cloud-functions/protos/protos.js | 2 +- packages/google-cloud-functions/synth.metadata | 12 ++++++------ 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json index 7fc36812b0b..bfeb6841fd6 100644 --- a/packages/google-cloud-functions/.repo-metadata.json +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/functions", "client_documentation": "https://googleapis.dev/nodejs/nodejs-functions/latest/index.html", "issue_tracker": "", - "release_level": "beta", + "release_level": "ga", "language": "nodejs", "repo": "googleapis/nodejs-functions", "distribution_name": "@google-cloud/functions", diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index 9823cbf3730..e2d37126787 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -4,7 +4,7 @@ # [Google Cloud Functions: Node.js Client](https://github.com/googleapis/nodejs-functions) -[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/functions.svg)](https://www.npmjs.org/package/@google-cloud/functions) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-functions/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-functions) @@ -124,11 +124,12 @@ _Legacy Node.js versions are supported as a best effort:_ This library follows [Semantic Versioning](http://semver.org/). +This library is considered to be **General Availability (GA)**. This means it +is stable; the code surface will not change in backwards-incompatible ways +unless absolutely necessary (e.g. because of critical security issues) or with +an extensive deprecation period. Issues and requests against **GA** libraries +are addressed with the highest priority. -This library is considered to be in **beta**. This means it is expected to be -mostly stable while we work toward a general availability release; however, -complete stability is not guaranteed. We will address issues and requests -against beta libraries with a high priority. diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 224dc217b5d..133208b60cc 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import * as Long from "long"; -import {protobuf as $protobuf} from "google-gax"; +import * as $protobuf from "protobufjs"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 5f40406c5c1..db678e84863 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -19,7 +19,7 @@ define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("google-gax").protobufMinimal); + module.exports = factory(require("protobufjs/minimal")); })(this, function($protobuf) { "use strict"; diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index c7ad3592c77..010eba8ff29 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -3,23 +3,23 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "3dba59a5e10e040a3b2c96af4b19121061ecb509" + "remote": "git@github.com:googleapis/nodejs-functions.git", + "sha": "3613883d5f6bd3263c7308456d839bdda983543e" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", - "internalRef": "327369997" + "sha": "2db5725bf898b544a0cf951e1694d3b0fce5eda3", + "internalRef": "329384854" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "8cf6d2834ad14318e64429c3b94f6443ae83daf9" + "sha": "80f46100c047bc47efe0025ee537dc8ee413ad04" } } ], @@ -103,5 +103,5 @@ "test/gapic_cloud_functions_service_v1.ts", "tsconfig.json", "webpack.config.js" - ] + ] } \ No newline at end of file From 5488c8a1ff63fc6f9fcf843ea803d71a38274c68 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2020 16:30:15 -0700 Subject: [PATCH 027/123] chore: release 1.1.0 (#24) * chore: updated samples/package.json [ci skip] * chore: updated CHANGELOG.md [ci skip] * chore: updated package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index bf0d6a155ba..24ef8cc03d7 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.1.0](https://www.github.com/googleapis/nodejs-functions/compare/v1.0.1...v1.1.0) (2020-09-01) + + +### Features + +* promote library to GA ([#22](https://www.github.com/googleapis/nodejs-functions/issues/22)) ([ad3b6d0](https://www.github.com/googleapis/nodejs-functions/commit/ad3b6d0e72cda6414466fb6a8127afa155e955a7)) + ### [1.0.1](https://www.github.com/googleapis/nodejs-functions/compare/v1.0.0...v1.0.1) (2020-08-03) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 52ab9241393..d5fd8ca5725 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.0.1", + "version": "1.1.0", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", From f03eaa14a0bb5b9b5d6d365335123172ab3c93fb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 3 Sep 2020 10:36:47 -0700 Subject: [PATCH 028/123] chore: update proto imports (#25) --- packages/google-cloud-functions/protos/protos.d.ts | 2 +- packages/google-cloud-functions/protos/protos.js | 2 +- packages/google-cloud-functions/synth.metadata | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 133208b60cc..224dc217b5d 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import * as Long from "long"; -import * as $protobuf from "protobufjs"; +import {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index db678e84863..5f40406c5c1 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -19,7 +19,7 @@ define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("protobufjs/minimal")); + module.exports = factory(require("google-gax").protobufMinimal); })(this, function($protobuf) { "use strict"; diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 010eba8ff29..ac9ef08edf9 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -3,8 +3,8 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-functions.git", - "sha": "3613883d5f6bd3263c7308456d839bdda983543e" + "remote": "https://github.com/googleapis/nodejs-functions.git", + "sha": "d4c6acbf661215b9e9b40e42236ee76803f87672" } }, { @@ -103,5 +103,5 @@ "test/gapic_cloud_functions_service_v1.ts", "tsconfig.json", "webpack.config.js" - ] + ] } \ No newline at end of file From 3d0008f012356097723ce2692e3ee14c7a745388 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 12 Sep 2020 14:06:20 -0700 Subject: [PATCH 029/123] build(test): recursively find test files; fail on unsupported dependency versions (#27) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/690c7a47-5578-464e-a3d6-7b377467cdd9/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/fdd03c161003ab97657cc0218f25c82c89ddf4b6 --- packages/google-cloud-functions/.mocharc.js | 3 ++- packages/google-cloud-functions/synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-functions/.mocharc.js b/packages/google-cloud-functions/.mocharc.js index ff7b34fa5d1..0b600509bed 100644 --- a/packages/google-cloud-functions/.mocharc.js +++ b/packages/google-cloud-functions/.mocharc.js @@ -14,7 +14,8 @@ const config = { "enable-source-maps": true, "throw-deprecation": true, - "timeout": 10000 + "timeout": 10000, + "recursive": true } if (process.env.MOCHA_THROW_DEPRECATION === 'false') { delete config['throw-deprecation']; diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index ac9ef08edf9..0f40bc1f79e 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "d4c6acbf661215b9e9b40e42236ee76803f87672" + "sha": "bfa552925b6b75478381e391c9d2298ecbfa584e" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "80f46100c047bc47efe0025ee537dc8ee413ad04" + "sha": "fdd03c161003ab97657cc0218f25c82c89ddf4b6" } } ], From 2a210ea233e24d4273a5a6dce0a8f6254b221bb4 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 1 Oct 2020 05:06:21 -0700 Subject: [PATCH 030/123] chore: update bucket for cloud-rad (#28) Co-authored-by: gcf-merge-on-green[bot] <60162190+gcf-merge-on-green[bot]@users.noreply.github.com> Source-Author: F. Hinkelmann Source-Date: Wed Sep 30 14:13:57 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 079dcce498117f9570cebe6e6cff254b38ba3860 Source-Link: https://github.com/googleapis/synthtool/commit/079dcce498117f9570cebe6e6cff254b38ba3860 --- packages/google-cloud-functions/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 0f40bc1f79e..8772a44a6e0 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "bfa552925b6b75478381e391c9d2298ecbfa584e" + "sha": "2bd53cde35ba684f11d6c03f51a8bad84e9b71d8" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "fdd03c161003ab97657cc0218f25c82c89ddf4b6" + "sha": "079dcce498117f9570cebe6e6cff254b38ba3860" } } ], From e5f1adf4bd0e8fe5d6ec87f55a38f71de406ca8c Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 5 Oct 2020 10:42:24 -0700 Subject: [PATCH 031/123] build(node_library): migrate to Trampoline V2 (#29) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/939e9a1a-ee83-4100-84cf-4883fa030728/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9 --- packages/google-cloud-functions/synth.metadata | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 8772a44a6e0..2e8d49b8807 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "2bd53cde35ba684f11d6c03f51a8bad84e9b71d8" + "sha": "aa3f1412754ccb49b3b74e0dae7bdd0c40ce600c" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "079dcce498117f9570cebe6e6cff254b38ba3860" + "sha": "0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9" } } ], @@ -75,10 +75,12 @@ ".kokoro/test.bat", ".kokoro/test.sh", ".kokoro/trampoline.sh", + ".kokoro/trampoline_v2.sh", ".mocharc.js", ".nycrc", ".prettierignore", ".prettierrc.js", + ".trampolinerc", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "LICENSE", From aa52c118ab9413b5c1ee65d24e5ec085ff5dc07f Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 12 Oct 2020 21:56:13 +0200 Subject: [PATCH 032/123] chore(deps): update dependency webpack-cli to v4 (#32) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [webpack-cli](https://togithub.com/webpack/webpack-cli) | devDependencies | major | [`^3.3.12` -> `^4.0.0`](https://renovatebot.com/diffs/npm/webpack-cli/3.3.12/4.0.0) | --- ### Release Notes
webpack/webpack-cli ### [`v4.0.0`](https://togithub.com/webpack/webpack-cli/blob/master/CHANGELOG.md#​400-httpsgithubcomwebpackwebpack-clicomparewebpack-cli400-rc1webpack-cli400-2020-10-10) [Compare Source](https://togithub.com/webpack/webpack-cli/compare/v3.3.12...webpack-cli@4.0.0) ##### Bug Fixes - add compilation lifecycle in watch instance ([#​1903](https://togithub.com/webpack/webpack-cli/issues/1903)) ([02b6d21](https://togithub.com/webpack/webpack-cli/commit/02b6d21eaa20166a7ed37816de716b8fc22b756a)) - cleanup `package-utils` package ([#​1822](https://togithub.com/webpack/webpack-cli/issues/1822)) ([fd5b92b](https://togithub.com/webpack/webpack-cli/commit/fd5b92b3cd40361daec5bf4486e455a41f4c9738)) - cli-executer supplies args further up ([#​1904](https://togithub.com/webpack/webpack-cli/issues/1904)) ([097564a](https://togithub.com/webpack/webpack-cli/commit/097564a851b36b63e0a6bf88144997ef65aa057a)) - exit code for validation errors ([59f6303](https://togithub.com/webpack/webpack-cli/commit/59f63037fcbdbb8934b578b9adf5725bc4ae1235)) - exit process in case of schema errors ([71e89b4](https://togithub.com/webpack/webpack-cli/commit/71e89b4092d953ea587cc4f606451ab78cbcdb93)) ##### Features - assign config paths in build dependencies in cache config ([#​1900](https://togithub.com/webpack/webpack-cli/issues/1900)) ([7e90f11](https://togithub.com/webpack/webpack-cli/commit/7e90f110b119f36ef9def4f66cf4e17ccf1438cd))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index d5fd8ca5725..847678fe998 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -58,7 +58,7 @@ "ts-loader": "^8.0.1", "typescript": "^3.9.7", "webpack": "^4.43.0", - "webpack-cli": "^3.3.12" + "webpack-cli": "^4.0.0" }, "engines": { "node": ">=10.0.0" From 4ea4b731d206ee59ca2bfb8fc9eb0942a48a9445 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 14 Oct 2020 23:04:11 +0200 Subject: [PATCH 033/123] chore(deps): update dependency webpack to v5 (#31) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [webpack](https://togithub.com/webpack/webpack) | devDependencies | major | [`^4.43.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/webpack/4.44.2/5.1.0) | --- ### Release Notes
webpack/webpack ### [`v5.1.0`](https://togithub.com/webpack/webpack/releases/v5.1.0) [Compare Source](https://togithub.com/webpack/webpack/compare/v5.0.0...v5.1.0) ### Features - expose `webpack` property from `Compiler` - expose `cleverMerge`, `EntryOptionPlugin`, `DynamicEntryPlugin` ### Bugfixes - missing `require("..").xxx` in try-catch produces a warning instead of an error now - handle reexports in concatenated modules correctly when they are side-effect-free - fix incorrect deprecation message for ModuleTemplate.hooks.hash ### [`v5.0.0`](https://togithub.com/webpack/webpack/releases/v5.0.0) [Compare Source](https://togithub.com/webpack/webpack/compare/v4.44.2...v5.0.0) [Announcement and changelog](https://webpack.js.org/blog/2020-10-10-webpack-5-release/)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 847678fe998..15d3e3d2426 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -57,7 +57,7 @@ "sinon": "^9.0.2", "ts-loader": "^8.0.1", "typescript": "^3.9.7", - "webpack": "^4.43.0", + "webpack": "^5.0.0", "webpack-cli": "^4.0.0" }, "engines": { From 09fcefbc6dfebe8089cb39d31bf97997b97f1b1f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 16 Oct 2020 10:08:40 -0700 Subject: [PATCH 034/123] build: only check --engine-strict for production deps (#33) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/02b30105-142c-418e-95f6-025914ce48a3/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/5451633881133e5573cc271a18e73b18caca8b1b --- packages/google-cloud-functions/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 2e8d49b8807..b6f60a3f6cf 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "aa3f1412754ccb49b3b74e0dae7bdd0c40ce600c" + "sha": "c52c28928ba11cb3895241cd815964e993585673" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9" + "sha": "5451633881133e5573cc271a18e73b18caca8b1b" } } ], From 38dab468c2ad962affc98ea2672dbe9016feadb8 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 27 Oct 2020 11:12:22 -0700 Subject: [PATCH 035/123] docs: updated code of conduct (includes update to actions) (#35) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/6be78fc1-147d-40e3-a003-ed65fa912e63/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/89c849ba5013e45e8fb688b138f33c2ec6083dc5 Source-Link: https://github.com/googleapis/synthtool/commit/a783321fd55f010709294455584a553f4b24b944 Source-Link: https://github.com/googleapis/synthtool/commit/b7413d38b763827c72c0360f0a3d286c84656eeb Source-Link: https://github.com/googleapis/synthtool/commit/5f6ef0ec5501d33c4667885b37a7685a30d41a76 Source-Link: https://github.com/googleapis/synthtool/commit/901ddd44e9ef7887ee681b9183bbdea99437fdcc Source-Link: https://github.com/googleapis/synthtool/commit/f96d3b455fe27c3dc7bc37c3c9cd27b1c6d269c8 --- .../google-cloud-functions/CODE_OF_CONDUCT.md | 123 +++++++++++++----- .../google-cloud-functions/synth.metadata | 4 +- 2 files changed, 89 insertions(+), 38 deletions(-) diff --git a/packages/google-cloud-functions/CODE_OF_CONDUCT.md b/packages/google-cloud-functions/CODE_OF_CONDUCT.md index 46b2a08ea6d..2add2547a81 100644 --- a/packages/google-cloud-functions/CODE_OF_CONDUCT.md +++ b/packages/google-cloud-functions/CODE_OF_CONDUCT.md @@ -1,43 +1,94 @@ -# Contributor Code of Conduct + +# Code of Conduct -As contributors and maintainers of this project, -and in the interest of fostering an open and welcoming community, -we pledge to respect all people who contribute through reporting issues, -posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. +## Our Pledge -We are committed to making participation in this project -a harassment-free experience for everyone, -regardless of level of experience, gender, gender identity and expression, -sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, religion, or nationality. +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, -such as physical or electronic -addresses, without explicit permission -* Other unethical or unprofessional conduct. +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct. -By adopting this Code of Conduct, -project maintainers commit themselves to fairly and consistently -applying these principles to every aspect of managing this project. -Project maintainers who do not follow or enforce the Code of Conduct -may be permanently removed from the project team. - -This code of conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior -may be reported by opening an issue -or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, -available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index b6f60a3f6cf..69056d791f0 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "c52c28928ba11cb3895241cd815964e993585673" + "sha": "cb1743204ba732cde127481a1b2de9cf37c9ed22" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5451633881133e5573cc271a18e73b18caca8b1b" + "sha": "89c849ba5013e45e8fb688b138f33c2ec6083dc5" } } ], From 180b9f078e49425bdb05ce0571a0f6f502dc4ae3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 2 Nov 2020 15:58:25 -0800 Subject: [PATCH 036/123] build(node): add KOKORO_BUILD_ARTIFACTS_SUBDIR to env (#36) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/6fe1a2b3-59cc-42e8-a9d9-5ebb537fe61c/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/ba9918cd22874245b55734f57470c719b577e591 --- packages/google-cloud-functions/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 69056d791f0..dd7cfdbb298 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "cb1743204ba732cde127481a1b2de9cf37c9ed22" + "sha": "b08b278a5813312090055a9956b04bd6fb1030af" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "89c849ba5013e45e8fb688b138f33c2ec6083dc5" + "sha": "ba9918cd22874245b55734f57470c719b577e591" } } ], From 671a8545a435d8e85a66464884f09af19f03602a Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Fri, 6 Nov 2020 15:42:23 -0800 Subject: [PATCH 037/123] fix: do not modify options object, use defaultScopes (#38) Regenerated the library using [gapic-generator-typescript](https://github.com/googleapis/gapic-generator-typescript) v1.2.1. --- .../__pycache__/synth.cpython-37.pyc | Bin 972 -> 988 bytes packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/src/index.ts | 1 + .../src/v1/cloud_functions_service_client.ts | 250 +++++++++++------- .../google-cloud-functions/synth.metadata | 17 +- .../system-test/fixtures/sample/src/index.ts | 11 +- .../system-test/install.ts | 18 +- 7 files changed, 179 insertions(+), 120 deletions(-) diff --git a/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc b/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc index 20c6d8061d62ff7649331a110615ca0453a9f5bb..1c06c44421428324ce0d9dc6d0ca5c6966b93a35 100644 GIT binary patch delta 62 zcmX@ZeutggiIcqNzKpGPfsqG+{qja04DYh A3;+NC diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 15d3e3d2426..191887abaf2 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,7 +39,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^2.6.3" + "google-gax": "^2.9.2" }, "devDependencies": { "@types/mocha": "^8.0.0", diff --git a/packages/google-cloud-functions/src/index.ts b/packages/google-cloud-functions/src/index.ts index 885e9604269..395643b198b 100644 --- a/packages/google-cloud-functions/src/index.ts +++ b/packages/google-cloud-functions/src/index.ts @@ -19,6 +19,7 @@ import * as v1 from './v1'; const CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; +type CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; export {v1, CloudFunctionsServiceClient}; export default {v1, CloudFunctionsServiceClient}; diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index a4b626bb6d2..7b7506e509e 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -62,8 +62,10 @@ export class CloudFunctionsServiceClient { /** * Construct an instance of CloudFunctionsServiceClient. * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. + * @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/master/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] @@ -83,44 +85,34 @@ export class CloudFunctionsServiceClient { * 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. + * TODO(@alexander-fenster): link to gax documentation. + * @param {boolean} fallback - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. */ - constructor(opts?: ClientOptions) { - // Ensure that options include the service address and port. + // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof CloudFunctionsServiceClient; const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; - const port = opts && opts.port ? opts.port : staticMembers.port; + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? typeof window !== 'undefined'; + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - if (!opts) { - opts = {servicePath, port}; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; } - opts.servicePath = opts.servicePath || servicePath; - opts.port = opts.port || port; - - // users can override the config from client side, like retry codes name. - // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 - // The way to override client config for Showcase API: - // - // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} - // const showcaseClient = new showcaseClient({ projectId, customConfig }); - opts.clientConfig = opts.clientConfig || {}; - // If we're running in browser, it's OK to omit `fallback` since - // google-gax has `browser` field in its `package.json`. - // For Electron (which does not respect `browser` field), - // pass `{fallback: true}` to the CloudFunctionsServiceClient constructor. + // Choose either gRPC or proto-over-HTTP implementation of google-gax. this._gaxModule = opts.fallback ? gax.fallback : gax; - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = (this - .constructor as typeof CloudFunctionsServiceClient).scopes; + // 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. @@ -129,6 +121,11 @@ export class CloudFunctionsServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -326,6 +323,7 @@ export class CloudFunctionsServiceClient { /** * The DNS address for this API service. + * @returns {string} The DNS address for this service. */ static get servicePath() { return 'cloudfunctions.googleapis.com'; @@ -334,6 +332,7 @@ export class CloudFunctionsServiceClient { /** * The DNS address for this API service - same as servicePath(), * exists for compatibility reasons. + * @returns {string} The DNS address for this service. */ static get apiEndpoint() { return 'cloudfunctions.googleapis.com'; @@ -341,6 +340,7 @@ export class CloudFunctionsServiceClient { /** * The port for this API service. + * @returns {number} The default port for this service. */ static get port() { return 443; @@ -349,6 +349,7 @@ export class CloudFunctionsServiceClient { /** * 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']; @@ -358,8 +359,7 @@ export class CloudFunctionsServiceClient { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. + * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( callback?: Callback @@ -412,7 +412,11 @@ export class CloudFunctionsServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getFunction(request); */ getFunction( request: protos.google.cloud.functions.v1.IGetFunctionRequest, @@ -499,7 +503,11 @@ export class CloudFunctionsServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [CallFunctionResponse]{@link google.cloud.functions.v1.CallFunctionResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.callFunction(request); */ callFunction( request: protos.google.cloud.functions.v1.ICallFunctionRequest, @@ -610,7 +618,11 @@ export class CloudFunctionsServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v1.GenerateUploadUrlResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.generateUploadUrl(request); */ generateUploadUrl( request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, @@ -706,7 +718,11 @@ export class CloudFunctionsServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v1.GenerateDownloadUrlResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.generateDownloadUrl(request); */ generateDownloadUrl( request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, @@ -797,7 +813,11 @@ export class CloudFunctionsServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.setIamPolicy(request); */ setIamPolicy( request: protos.google.iam.v1.ISetIamPolicyRequest, @@ -883,7 +903,11 @@ export class CloudFunctionsServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getIamPolicy(request); */ getIamPolicy( request: protos.google.iam.v1.IGetIamPolicyRequest, @@ -972,7 +996,11 @@ export class CloudFunctionsServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.testIamPermissions(request); */ testIamPermissions( request: protos.google.iam.v1.ITestIamPermissionsRequest, @@ -1066,8 +1094,15 @@ export class CloudFunctionsServiceClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.createFunction(request); + * const [response] = await operation.promise(); */ createFunction( request: protos.google.cloud.functions.v1.ICreateFunctionRequest, @@ -1119,18 +1154,19 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.createFunction(request, options, callback); } /** - * Check the status of the long running operation returned by the createFunction() method. + * Check the status of the long running operation returned by `createFunction()`. * @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. - * - * @example: - * const decodedOperation = await checkCreateFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkCreateFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); */ async checkCreateFunctionProgress( name: string @@ -1202,8 +1238,15 @@ export class CloudFunctionsServiceClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.updateFunction(request); + * const [response] = await operation.promise(); */ updateFunction( request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, @@ -1255,18 +1298,19 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.updateFunction(request, options, callback); } /** - * Check the status of the long running operation returned by the updateFunction() method. + * Check the status of the long running operation returned by `updateFunction()`. * @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. - * - * @example: - * const decodedOperation = await checkUpdateFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkUpdateFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); */ async checkUpdateFunctionProgress( name: string @@ -1338,8 +1382,15 @@ export class CloudFunctionsServiceClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.deleteFunction(request); + * const [response] = await operation.promise(); */ deleteFunction( request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, @@ -1391,18 +1442,19 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.deleteFunction(request, options, callback); } /** - * Check the status of the long running operation returned by the deleteFunction() method. + * Check the status of the long running operation returned by `deleteFunction()`. * @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. - * - * @example: - * const decodedOperation = await checkDeleteFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); - * + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkDeleteFunctionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); */ async checkDeleteFunctionProgress( name: string @@ -1480,19 +1532,14 @@ export class CloudFunctionsServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. - * The client library support auto-pagination by default: it will call the API as many + * 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. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [CloudFunction]{@link google.cloud.functions.v1.CloudFunction} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListFunctionsRequest]{@link google.cloud.functions.v1.ListFunctionsRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListFunctionsResponse]{@link google.cloud.functions.v1.ListFunctionsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. + * Note that it can affect your quota. + * We recommend using `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. */ listFunctions( request: protos.google.cloud.functions.v1.IListFunctionsRequest, @@ -1540,18 +1587,7 @@ export class CloudFunctionsServiceClient { } /** - * Equivalent to {@link listFunctions}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listFunctions} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1572,6 +1608,13 @@ export class CloudFunctionsServiceClient { * 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 [CloudFunction]{@link google.cloud.functions.v1.CloudFunction} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. */ listFunctionsStream( request?: protos.google.cloud.functions.v1.IListFunctionsRequest, @@ -1596,10 +1639,9 @@ export class CloudFunctionsServiceClient { } /** - * Equivalent to {@link listFunctions}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * Equivalent to `listFunctions`, 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 @@ -1619,7 +1661,18 @@ export class CloudFunctionsServiceClient { * @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 conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listFunctionsAsync(request); + * for await (const response of iterable) { + * // process response + * } */ listFunctionsAsync( request?: protos.google.cloud.functions.v1.IListFunctionsRequest, @@ -1736,9 +1789,10 @@ export class CloudFunctionsServiceClient { } /** - * Terminate the GRPC channel and close the client. + * 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 { this.initialize(); diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index dd7cfdbb298..ebae21f3e3c 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -3,23 +3,15 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "b08b278a5813312090055a9956b04bd6fb1030af" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2db5725bf898b544a0cf951e1694d3b0fce5eda3", - "internalRef": "329384854" + "remote": "git@github.com:googleapis/nodejs-functions.git", + "sha": "22d69ec672c8c93dd4a2e60c8c6272dd2545b73a" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "ba9918cd22874245b55734f57470c719b577e591" + "sha": "1f1148d3c7a7a52f0c98077f976bd9b3c948ee2b" } } ], @@ -85,8 +77,10 @@ "CONTRIBUTING.md", "LICENSE", "README.md", + "__pycache__/synth.cpython-37.pyc", "api-extractor.json", "linkinator.config.json", + "package-lock.json.620595561", "protos/google/cloud/functions/v1/functions.proto", "protos/google/cloud/functions/v1/operations.proto", "protos/protos.d.ts", @@ -94,6 +88,7 @@ "protos/protos.json", "renovate.json", "samples/README.md", + "samples/package-lock.json.2747171955", "src/index.ts", "src/v1/cloud_functions_service_client.ts", "src/v1/cloud_functions_service_client_config.json", diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts index 7870bd5b378..03b5fee3911 100644 --- a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts @@ -18,8 +18,17 @@ import {CloudFunctionsServiceClient} from '@google-cloud/functions'; +// check that the client class type name can be used +function doStuffWithCloudFunctionsServiceClient( + client: CloudFunctionsServiceClient +) { + client.close(); +} + function main() { - new CloudFunctionsServiceClient(); + // check that the client instance can be created + const cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + doStuffWithCloudFunctionsServiceClient(cloudFunctionsServiceClient); } main(); diff --git a/packages/google-cloud-functions/system-test/install.ts b/packages/google-cloud-functions/system-test/install.ts index 4c1ba3eb79a..39d90f771de 100644 --- a/packages/google-cloud-functions/system-test/install.ts +++ b/packages/google-cloud-functions/system-test/install.ts @@ -20,32 +20,32 @@ import {packNTest} from 'pack-n-play'; import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; -describe('typescript consumer tests', () => { - it('should have correct type signature for typescript users', async function () { +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), sample: { - description: 'typescript based user can use the type definitions', + description: 'TypeScript user can use the type definitions', ts: readFileSync( './system-test/fixtures/sample/src/index.ts' ).toString(), }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); }); - it('should have correct type signature for javascript users', async function () { + it('JavaScript code', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), sample: { - description: 'typescript based user can use the type definitions', + description: 'JavaScript user can use the library', ts: readFileSync( './system-test/fixtures/sample/src/index.js' ).toString(), }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); }); }); From ea17f87a1401cad142ff5ffc1e4ceb86814bc500 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2020 12:17:27 -0800 Subject: [PATCH 038/123] chore: release 1.1.1 (#39) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 24ef8cc03d7..e699132bea1 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.1](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.0...v1.1.1) (2020-11-06) + + +### Bug Fixes + +* do not modify options object, use defaultScopes ([#38](https://www.github.com/googleapis/nodejs-functions/issues/38)) ([24738f1](https://www.github.com/googleapis/nodejs-functions/commit/24738f112727b56fc180b2ad3280456ccabd1af8)) + ## [1.1.0](https://www.github.com/googleapis/nodejs-functions/compare/v1.0.1...v1.1.0) (2020-09-01) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 191887abaf2..6ac453cd8e0 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.0", + "version": "1.1.1", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", From f03f9e58839d9cd015669c0f4620f42edd59acad Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 24 Nov 2020 07:52:53 -0800 Subject: [PATCH 039/123] fix(browser): check for fetch on window --- .../google-cloud-functions/protos/protos.json | 218 ++++++++++++++++-- .../src/v1/cloud_functions_service_client.ts | 130 ++++++----- .../google-cloud-functions/synth.metadata | 87 +------ 3 files changed, 279 insertions(+), 156 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index e99a0a0b65f..b028125c08c 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -26,7 +26,14 @@ "responseType": "ListFunctionsResponse", "options": { "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/functions" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/functions" + } + } + ] }, "GetFunction": { "requestType": "GetFunctionRequest", @@ -34,7 +41,17 @@ "options": { "(google.api.http).get": "/v1/{name=projects/*/locations/*/functions/*}", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "CreateFunction": { "requestType": "CreateFunctionRequest", @@ -45,7 +62,24 @@ "(google.api.method_signature)": "location,function", "(google.longrunning.operation_info).response_type": "CloudFunction", "(google.longrunning.operation_info).metadata_type": "OperationMetadataV1" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{location=projects/*/locations/*}/functions", + "body": "function" + } + }, + { + "(google.api.method_signature)": "location,function" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "CloudFunction", + "metadata_type": "OperationMetadataV1" + } + } + ] }, "UpdateFunction": { "requestType": "UpdateFunctionRequest", @@ -56,7 +90,24 @@ "(google.api.method_signature)": "function", "(google.longrunning.operation_info).response_type": "CloudFunction", "(google.longrunning.operation_info).metadata_type": "OperationMetadataV1" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{function.name=projects/*/locations/*/functions/*}", + "body": "function" + } + }, + { + "(google.api.method_signature)": "function" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "CloudFunction", + "metadata_type": "OperationMetadataV1" + } + } + ] }, "DeleteFunction": { "requestType": "DeleteFunctionRequest", @@ -66,7 +117,23 @@ "(google.api.method_signature)": "name", "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", "(google.longrunning.operation_info).metadata_type": "OperationMetadataV1" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "OperationMetadataV1" + } + } + ] }, "CallFunction": { "requestType": "CallFunctionRequest", @@ -75,7 +142,18 @@ "(google.api.http).post": "/v1/{name=projects/*/locations/*/functions/*}:call", "(google.api.http).body": "*", "(google.api.method_signature)": "name,data" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/functions/*}:call", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,data" + } + ] }, "GenerateUploadUrl": { "requestType": "GenerateUploadUrlRequest", @@ -83,7 +161,15 @@ "options": { "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "body": "*" + } + } + ] }, "GenerateDownloadUrl": { "requestType": "GenerateDownloadUrlRequest", @@ -91,7 +177,15 @@ "options": { "(google.api.http).post": "/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "body": "*" + } + } + ] }, "SetIamPolicy": { "requestType": "google.iam.v1.SetIamPolicyRequest", @@ -99,14 +193,29 @@ "options": { "(google.api.http).post": "/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=projects/*/locations/*/functions/*}:setIamPolicy", + "body": "*" + } + } + ] }, "GetIamPolicy": { "requestType": "google.iam.v1.GetIamPolicyRequest", "responseType": "google.iam.v1.Policy", "options": { "(google.api.http).get": "/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{resource=projects/*/locations/*/functions/*}:getIamPolicy" + } + } + ] }, "TestIamPermissions": { "requestType": "google.iam.v1.TestIamPermissionsRequest", @@ -114,7 +223,15 @@ "options": { "(google.api.http).post": "/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=projects/*/locations/*/functions/*}:testIamPermissions", + "body": "*" + } + } + ] } } }, @@ -1714,7 +1831,15 @@ "options": { "(google.api.http).post": "/v1/{resource=**}:setIamPolicy", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:setIamPolicy", + "body": "*" + } + } + ] }, "GetIamPolicy": { "requestType": "GetIamPolicyRequest", @@ -1722,7 +1847,15 @@ "options": { "(google.api.http).post": "/v1/{resource=**}:getIamPolicy", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:getIamPolicy", + "body": "*" + } + } + ] }, "TestIamPermissions": { "requestType": "TestIamPermissionsRequest", @@ -1730,7 +1863,15 @@ "options": { "(google.api.http).post": "/v1/{resource=**}:testIamPermissions", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:testIamPermissions", + "body": "*" + } + } + ] } } }, @@ -1974,7 +2115,17 @@ "options": { "(google.api.http).get": "/v1/{name=operations}", "(google.api.method_signature)": "name,filter" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations}" + } + }, + { + "(google.api.method_signature)": "name,filter" + } + ] }, "GetOperation": { "requestType": "GetOperationRequest", @@ -1982,7 +2133,17 @@ "options": { "(google.api.http).get": "/v1/{name=operations/**}", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "DeleteOperation": { "requestType": "DeleteOperationRequest", @@ -1990,7 +2151,17 @@ "options": { "(google.api.http).delete": "/v1/{name=operations/**}", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "CancelOperation": { "requestType": "CancelOperationRequest", @@ -1999,7 +2170,18 @@ "(google.api.http).post": "/v1/{name=operations/**}:cancel", "(google.api.http).body": "*", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=operations/**}:cancel", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "WaitOperation": { "requestType": "WaitOperationRequest", diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 7b7506e509e..2a75f330bdf 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, @@ -31,6 +32,11 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1/cloud_functions_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './cloud_functions_service_client_config.json'; import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; @@ -85,9 +91,9 @@ export class CloudFunctionsServiceClient { * 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. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -101,7 +107,9 @@ export class CloudFunctionsServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + 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. @@ -376,7 +384,7 @@ export class CloudFunctionsServiceClient { // ------------------- getFunction( request: protos.google.cloud.functions.v1.IGetFunctionRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.functions.v1.ICloudFunction, @@ -386,7 +394,7 @@ export class CloudFunctionsServiceClient { >; getFunction( request: protos.google.cloud.functions.v1.IGetFunctionRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IGetFunctionRequest | null | undefined, @@ -421,7 +429,7 @@ export class CloudFunctionsServiceClient { getFunction( request: protos.google.cloud.functions.v1.IGetFunctionRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.functions.v1.ICloudFunction, | protos.google.cloud.functions.v1.IGetFunctionRequest @@ -442,12 +450,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -462,7 +470,7 @@ export class CloudFunctionsServiceClient { } callFunction( request: protos.google.cloud.functions.v1.ICallFunctionRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.functions.v1.ICallFunctionResponse, @@ -472,7 +480,7 @@ export class CloudFunctionsServiceClient { >; callFunction( request: protos.google.cloud.functions.v1.ICallFunctionRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.functions.v1.ICallFunctionResponse, protos.google.cloud.functions.v1.ICallFunctionRequest | null | undefined, @@ -512,7 +520,7 @@ export class CloudFunctionsServiceClient { callFunction( request: protos.google.cloud.functions.v1.ICallFunctionRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.functions.v1.ICallFunctionResponse, | protos.google.cloud.functions.v1.ICallFunctionRequest @@ -533,12 +541,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -553,7 +561,7 @@ export class CloudFunctionsServiceClient { } generateUploadUrl( request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, @@ -563,7 +571,7 @@ export class CloudFunctionsServiceClient { >; generateUploadUrl( request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest @@ -627,7 +635,7 @@ export class CloudFunctionsServiceClient { generateUploadUrl( request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest @@ -650,12 +658,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -670,7 +678,7 @@ export class CloudFunctionsServiceClient { } generateDownloadUrl( request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, @@ -680,7 +688,7 @@ export class CloudFunctionsServiceClient { >; generateDownloadUrl( request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, | protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest @@ -727,7 +735,7 @@ export class CloudFunctionsServiceClient { generateDownloadUrl( request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, | protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest @@ -750,12 +758,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -770,7 +778,7 @@ export class CloudFunctionsServiceClient { } setIamPolicy( request: protos.google.iam.v1.ISetIamPolicyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.iam.v1.IPolicy, @@ -780,7 +788,7 @@ export class CloudFunctionsServiceClient { >; setIamPolicy( request: protos.google.iam.v1.ISetIamPolicyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, @@ -822,7 +830,7 @@ export class CloudFunctionsServiceClient { setIamPolicy( request: protos.google.iam.v1.ISetIamPolicyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, @@ -841,12 +849,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -861,7 +869,7 @@ export class CloudFunctionsServiceClient { } getIamPolicy( request: protos.google.iam.v1.IGetIamPolicyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.iam.v1.IPolicy, @@ -871,7 +879,7 @@ export class CloudFunctionsServiceClient { >; getIamPolicy( request: protos.google.iam.v1.IGetIamPolicyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, @@ -912,7 +920,7 @@ export class CloudFunctionsServiceClient { getIamPolicy( request: protos.google.iam.v1.IGetIamPolicyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, @@ -931,12 +939,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -951,7 +959,7 @@ export class CloudFunctionsServiceClient { } testIamPermissions( request: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.iam.v1.ITestIamPermissionsResponse, @@ -961,7 +969,7 @@ export class CloudFunctionsServiceClient { >; testIamPermissions( request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, @@ -1005,7 +1013,7 @@ export class CloudFunctionsServiceClient { testIamPermissions( request: protos.google.iam.v1.ITestIamPermissionsRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, @@ -1024,12 +1032,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1045,7 +1053,7 @@ export class CloudFunctionsServiceClient { createFunction( request: protos.google.cloud.functions.v1.ICreateFunctionRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -1058,7 +1066,7 @@ export class CloudFunctionsServiceClient { >; createFunction( request: protos.google.cloud.functions.v1.ICreateFunctionRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.functions.v1.ICloudFunction, @@ -1107,7 +1115,7 @@ export class CloudFunctionsServiceClient { createFunction( request: protos.google.cloud.functions.v1.ICreateFunctionRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.functions.v1.ICloudFunction, @@ -1135,12 +1143,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1192,7 +1200,7 @@ export class CloudFunctionsServiceClient { } updateFunction( request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -1205,7 +1213,7 @@ export class CloudFunctionsServiceClient { >; updateFunction( request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.functions.v1.ICloudFunction, @@ -1251,7 +1259,7 @@ export class CloudFunctionsServiceClient { updateFunction( request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.functions.v1.ICloudFunction, @@ -1279,12 +1287,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1336,7 +1344,7 @@ export class CloudFunctionsServiceClient { } deleteFunction( request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -1349,7 +1357,7 @@ export class CloudFunctionsServiceClient { >; deleteFunction( request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.protobuf.IEmpty, @@ -1395,7 +1403,7 @@ export class CloudFunctionsServiceClient { deleteFunction( request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.protobuf.IEmpty, @@ -1423,12 +1431,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1480,7 +1488,7 @@ export class CloudFunctionsServiceClient { } listFunctions( request: protos.google.cloud.functions.v1.IListFunctionsRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.functions.v1.ICloudFunction[], @@ -1490,7 +1498,7 @@ export class CloudFunctionsServiceClient { >; listFunctions( request: protos.google.cloud.functions.v1.IListFunctionsRequest, - options: gax.CallOptions, + options: CallOptions, callback: PaginationCallback< protos.google.cloud.functions.v1.IListFunctionsRequest, | protos.google.cloud.functions.v1.IListFunctionsResponse @@ -1544,7 +1552,7 @@ export class CloudFunctionsServiceClient { listFunctions( request: protos.google.cloud.functions.v1.IListFunctionsRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | PaginationCallback< protos.google.cloud.functions.v1.IListFunctionsRequest, | protos.google.cloud.functions.v1.IListFunctionsResponse @@ -1567,12 +1575,12 @@ export class CloudFunctionsServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1618,7 +1626,7 @@ export class CloudFunctionsServiceClient { */ listFunctionsStream( request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - options?: gax.CallOptions + options?: CallOptions ): Transform { request = request || {}; options = options || {}; @@ -1676,7 +1684,7 @@ export class CloudFunctionsServiceClient { */ listFunctionsAsync( request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - options?: gax.CallOptions + options?: CallOptions ): AsyncIterable { request = request || {}; options = options || {}; diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index ebae21f3e3c..6ad00663244 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -3,8 +3,16 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-functions.git", - "sha": "22d69ec672c8c93dd4a2e60c8c6272dd2545b73a" + "remote": "https://github.com/googleapis/nodejs-functions.git", + "sha": "1c75cbf5d0246f4465daa582e60a8dab6fc28fdb" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "37ba54d7ed4da3052ceff96292631c3b6aae0e63", + "internalRef": "343563501" } }, { @@ -25,80 +33,5 @@ "generator": "bazel" } } - ], - "generatedFiles": [ - ".eslintignore", - ".eslintrc.json", - ".gitattributes", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/release-please.yml", - ".github/workflows/ci.yaml", - ".gitignore", - ".jsdoc.js", - ".kokoro/.gitattributes", - ".kokoro/common.cfg", - ".kokoro/continuous/node10/common.cfg", - ".kokoro/continuous/node10/docs.cfg", - ".kokoro/continuous/node10/test.cfg", - ".kokoro/continuous/node12/common.cfg", - ".kokoro/continuous/node12/lint.cfg", - ".kokoro/continuous/node12/samples-test.cfg", - ".kokoro/continuous/node12/system-test.cfg", - ".kokoro/continuous/node12/test.cfg", - ".kokoro/docs.sh", - ".kokoro/lint.sh", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/node10/common.cfg", - ".kokoro/presubmit/node12/common.cfg", - ".kokoro/presubmit/node12/samples-test.cfg", - ".kokoro/presubmit/node12/system-test.cfg", - ".kokoro/presubmit/node12/test.cfg", - ".kokoro/publish.sh", - ".kokoro/release/docs-devsite.cfg", - ".kokoro/release/docs-devsite.sh", - ".kokoro/release/docs.cfg", - ".kokoro/release/docs.sh", - ".kokoro/release/publish.cfg", - ".kokoro/samples-test.sh", - ".kokoro/system-test.sh", - ".kokoro/test.bat", - ".kokoro/test.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".mocharc.js", - ".nycrc", - ".prettierignore", - ".prettierrc.js", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.md", - "LICENSE", - "README.md", - "__pycache__/synth.cpython-37.pyc", - "api-extractor.json", - "linkinator.config.json", - "package-lock.json.620595561", - "protos/google/cloud/functions/v1/functions.proto", - "protos/google/cloud/functions/v1/operations.proto", - "protos/protos.d.ts", - "protos/protos.js", - "protos/protos.json", - "renovate.json", - "samples/README.md", - "samples/package-lock.json.2747171955", - "src/index.ts", - "src/v1/cloud_functions_service_client.ts", - "src/v1/cloud_functions_service_client_config.json", - "src/v1/cloud_functions_service_proto_list.json", - "src/v1/index.ts", - "system-test/fixtures/sample/src/index.js", - "system-test/fixtures/sample/src/index.ts", - "system-test/install.ts", - "test/gapic_cloud_functions_service_v1.ts", - "tsconfig.json", - "webpack.config.js" ] } \ No newline at end of file From 07c997fd847210b8d51756b668544a88c99702f3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 25 Nov 2020 08:36:08 -0800 Subject: [PATCH 040/123] docs: spelling correction for "targetting" (#43) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/5eabbdbe-8996-4c29-9e16-a28495ddf684/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/15013eff642a7e7e855aed5a29e6e83c39beba2a --- packages/google-cloud-functions/README.md | 2 +- packages/google-cloud-functions/synth.metadata | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index e2d37126787..b0dcee36fd6 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -104,7 +104,7 @@ Our client libraries follow the [Node.js release schedule](https://nodejs.org/en Libraries are compatible with all current _active_ and _maintenance_ versions of Node.js. -Client libraries targetting some end-of-life versions of Node.js are available, and +Client libraries targeting some end-of-life versions of Node.js are available, and can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). The dist-tags follow the naming convention `legacy-(version)`. diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 6ad00663244..e6f64d18ea9 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "1c75cbf5d0246f4465daa582e60a8dab6fc28fdb" + "sha": "0aa94fa222e4ef0bb5a09d4aa3fa957bd8cc80cf" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1f1148d3c7a7a52f0c98077f976bd9b3c948ee2b" + "sha": "15013eff642a7e7e855aed5a29e6e83c39beba2a" } } ], From 054f7752ddf1f53be7b6401dd8817ff09f40eb57 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2020 19:42:13 +0000 Subject: [PATCH 041/123] chore: release 1.1.2 (#42) :robot: I have created a release \*beep\* \*boop\* --- ### [1.1.2](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.1...v1.1.2) (2020-11-25) ### Bug Fixes * **browser:** check for fetch on window ([0aa94fa](https://www.github.com/googleapis/nodejs-functions/commit/0aa94fa222e4ef0bb5a09d4aa3fa957bd8cc80cf)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index e699132bea1..c2acd90b69c 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.2](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.1...v1.1.2) (2020-11-25) + + +### Bug Fixes + +* **browser:** check for fetch on window ([0aa94fa](https://www.github.com/googleapis/nodejs-functions/commit/0aa94fa222e4ef0bb5a09d4aa3fa957bd8cc80cf)) + ### [1.1.1](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.0...v1.1.1) (2020-11-06) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 6ac453cd8e0..7e9c89fb386 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.1", + "version": "1.1.2", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", From 8783fa9dd933d3fc2a2532f69119feefd0547429 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 4 Dec 2020 08:58:20 -0800 Subject: [PATCH 042/123] chore: generate GAPIC metadata JSON file (#45) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/bca0aeb7-d7c6-4e0a-a65e-f13ab3f23aa9/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 345596855 Source-Link: https://github.com/googleapis/googleapis/commit/d189e871205fea665a9648f7c4676f027495ccaf --- .../src/v1/gapic_metadata.json | 137 ++++++++++++++++++ .../google-cloud-functions/synth.metadata | 6 +- 2 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 packages/google-cloud-functions/src/v1/gapic_metadata.json diff --git a/packages/google-cloud-functions/src/v1/gapic_metadata.json b/packages/google-cloud-functions/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..d48829005cf --- /dev/null +++ b/packages/google-cloud-functions/src/v1/gapic_metadata.json @@ -0,0 +1,137 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v1", + "libraryPackage": "@google-cloud/functions", + "services": { + "CloudFunctionsService": { + "clients": { + "grpc": { + "libraryClient": "CloudFunctionsServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "CallFunction": { + "methods": [ + "callFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudFunctionsServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "CallFunction": { + "methods": [ + "callFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index e6f64d18ea9..88610ac8798 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "0aa94fa222e4ef0bb5a09d4aa3fa957bd8cc80cf" + "sha": "85870d7c4e5f33612e33dd6419f82c448a1dcd0b" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "37ba54d7ed4da3052ceff96292631c3b6aae0e63", - "internalRef": "343563501" + "sha": "d189e871205fea665a9648f7c4676f027495ccaf", + "internalRef": "345596855" } }, { From 0f6742bea505f9a92b18744afe235978e6b355ee Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 22 Dec 2020 11:42:12 -0800 Subject: [PATCH 043/123] docs: add instructions for authenticating for system tests (#46) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9610e861-65a2-4035-85ab-1303620c4597/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/363fe305e9ce34a6cd53951c6ee5f997094b54ee --- packages/google-cloud-functions/CONTRIBUTING.md | 14 ++++++++++++-- packages/google-cloud-functions/README.md | 3 +-- packages/google-cloud-functions/synth.metadata | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-functions/CONTRIBUTING.md b/packages/google-cloud-functions/CONTRIBUTING.md index f6c4cf010e3..f7c51fb1b40 100644 --- a/packages/google-cloud-functions/CONTRIBUTING.md +++ b/packages/google-cloud-functions/CONTRIBUTING.md @@ -37,6 +37,14 @@ accept your pull requests. 1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling. 1. Submit a pull request. +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable the Google Cloud Functions API][enable_api]. +1. [Set up authentication with a service account][auth] so you can access the + API from your local workstation. + + ## Running the tests 1. [Prepare your environment for Node.js setup][setup]. @@ -51,11 +59,9 @@ accept your pull requests. npm test # Run sample integration tests. - gcloud auth application-default login npm run samples-test # Run all system tests. - gcloud auth application-default login npm run system-test 1. Lint (and maybe fix) any changes: @@ -63,3 +69,7 @@ accept your pull requests. npm run fix [setup]: https://cloud.google.com/nodejs/docs/setup +[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=cloudfunctions.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index b0dcee36fd6..94df53075a5 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -86,8 +86,7 @@ listFunctions(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-functions/tree/master/samples) directory. The samples' `README.md` -has instructions for running the samples. +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-functions/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 88610ac8798..f3322840973 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "85870d7c4e5f33612e33dd6419f82c448a1dcd0b" + "sha": "f0f2201fdfe717ba0c4c0f4c21df1ef5b3d79032" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "15013eff642a7e7e855aed5a29e6e83c39beba2a" + "sha": "363fe305e9ce34a6cd53951c6ee5f997094b54ee" } } ], From 578780818f3fb2e58ba3c5e71502f630b5901998 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 8 Jan 2021 19:30:24 -0800 Subject: [PATCH 044/123] docs: update dates (#47) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/39538a75-dd2e-4f49-b972-60368d19d19d/targets - [ ] To automatically regenerate this PR, check this box. --- packages/google-cloud-functions/.jsdoc.js | 4 ++-- packages/google-cloud-functions/protos/protos.d.ts | 2 +- packages/google-cloud-functions/protos/protos.js | 2 +- .../src/v1/cloud_functions_service_client.ts | 2 +- packages/google-cloud-functions/src/v1/index.ts | 2 +- packages/google-cloud-functions/synth.metadata | 2 +- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- packages/google-cloud-functions/system-test/install.ts | 2 +- .../test/gapic_cloud_functions_service_v1.ts | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/google-cloud-functions/.jsdoc.js b/packages/google-cloud-functions/.jsdoc.js index 1a5a5a31296..c4f9aebce6f 100644 --- a/packages/google-cloud-functions/.jsdoc.js +++ b/packages/google-cloud-functions/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2020 Google LLC', + copyright: 'Copyright 2021 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/functions', diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 224dc217b5d..8457c4d0474 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 5f40406c5c1..f3fa51c8c11 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 2a75f330bdf..2cfe7dcffba 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. diff --git a/packages/google-cloud-functions/src/v1/index.ts b/packages/google-cloud-functions/src/v1/index.ts index 581ee4368d9..3ac975fcc3e 100644 --- a/packages/google-cloud-functions/src/v1/index.ts +++ b/packages/google-cloud-functions/src/v1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index f3322840973..78258aec60b 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "f0f2201fdfe717ba0c4c0f4c21df1ef5b3d79032" + "sha": "7e5385e0fbbdd90d129028d32ebcf1f9ff1be81c" } }, { diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js index 7a7e29b3535..8c4ce42d642 100644 --- a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts index 03b5fee3911..38711df35e1 100644 --- a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. diff --git a/packages/google-cloud-functions/system-test/install.ts b/packages/google-cloud-functions/system-test/install.ts index 39d90f771de..d2d61c0396f 100644 --- a/packages/google-cloud-functions/system-test/install.ts +++ b/packages/google-cloud-functions/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index 917fe191335..1c811552194 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. From 4b21765df9861af2fb6af2bb7689ca68ad61f44e Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 2 Feb 2021 17:52:22 -0800 Subject: [PATCH 045/123] chore: update CODEOWNERS config (#52) --- packages/google-cloud-functions/.repo-metadata.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json index bfeb6841fd6..2f5deadd3ee 100644 --- a/packages/google-cloud-functions/.repo-metadata.json +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -9,5 +9,6 @@ "repo": "googleapis/nodejs-functions", "distribution_name": "@google-cloud/functions", "api_id": "cloudfunctions.googleapis.com", - "requires_billing": false -} \ No newline at end of file + "requires_billing": false, + "codeowner_team": "@googleapis/serverless-team" +} From 316df294aebd83780f3b477b79098634a14f482f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 3 Feb 2021 18:59:39 -0800 Subject: [PATCH 046/123] chore: add ResourceDescriptor style to protos (#48) autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. Co-authored-by: Justin Beckwith --- .../google-cloud-functions/protos/protos.d.ts | 12 +++ .../google-cloud-functions/protos/protos.js | 78 ++++++++++++++++++- .../google-cloud-functions/protos/protos.json | 13 +++- .../google-cloud-functions/synth.metadata | 2 +- 4 files changed, 102 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 8457c4d0474..1ab3c1949e4 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -2654,6 +2654,9 @@ export namespace google { /** ResourceDescriptor singular */ singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); } /** Represents a ResourceDescriptor. */ @@ -2683,6 +2686,9 @@ export namespace google { /** ResourceDescriptor singular. */ public singular: string; + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + /** * Creates a new ResourceDescriptor instance using the specified properties. * @param [properties] Properties to set @@ -2762,6 +2768,12 @@ export namespace google { ORIGINALLY_SINGLE_PATTERN = 1, FUTURE_MULTI_PATTERN = 2 } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } } /** Properties of a ResourceReference. */ diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index f3fa51c8c11..fcd7b704ad1 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -6315,6 +6315,7 @@ * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history * @property {string|null} [plural] ResourceDescriptor plural * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style */ /** @@ -6327,6 +6328,7 @@ */ function ResourceDescriptor(properties) { this.pattern = []; + this.style = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6381,6 +6383,14 @@ */ ResourceDescriptor.prototype.singular = ""; + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + /** * Creates a new ResourceDescriptor instance using the specified properties. * @function create @@ -6418,6 +6428,12 @@ writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } return writer; }; @@ -6472,6 +6488,16 @@ case 6: message.singular = reader.string(); break; + case 10: + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; default: reader.skipType(tag & 7); break; @@ -6535,6 +6561,18 @@ if (message.singular != null && message.hasOwnProperty("singular")) if (!$util.isString(message.singular)) return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } return null; }; @@ -6579,6 +6617,23 @@ message.plural = String(object.plural); if (object.singular != null) message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } return message; }; @@ -6595,8 +6650,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.pattern = []; + object.style = []; + } if (options.defaults) { object.type = ""; object.nameField = ""; @@ -6619,6 +6676,11 @@ object.plural = message.plural; if (message.singular != null && message.hasOwnProperty("singular")) object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } return object; }; @@ -6649,6 +6711,20 @@ return values; })(); + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + return ResourceDescriptor; })(); diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index b028125c08c..30eb316f43a 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -836,6 +836,11 @@ "singular": { "type": "string", "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 } }, "nested": { @@ -845,6 +850,12 @@ "ORIGINALLY_SINGLE_PATTERN": 1, "FUTURE_MULTI_PATTERN": 2 } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } } } }, @@ -864,7 +875,7 @@ }, "protobuf": { "options": { - "go_package": "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", + "go_package": "google.golang.org/protobuf/types/descriptorpb", "java_package": "com.google.protobuf", "java_outer_classname": "DescriptorProtos", "csharp_namespace": "Google.Protobuf.Reflection", diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 78258aec60b..30991ff9b0a 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "7e5385e0fbbdd90d129028d32ebcf1f9ff1be81c" + "sha": "98be716d08a5c5b97dfe69d7550036f8510fe06b" } }, { From 02f9c38df1247945fc6b6f6da4124649706c311f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 4 Feb 2021 09:10:36 -0800 Subject: [PATCH 047/123] chore: update CODEOWNERS and bot config (#54) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * refactor(nodejs): move build cop to flakybot Source-Author: Benjamin E. Coe Source-Date: Tue Jan 26 16:48:20 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: 57c23fa5705499a4181095ced81f0ee0933b64f6 Source-Link: https://github.com/googleapis/synthtool/commit/57c23fa5705499a4181095ced81f0ee0933b64f6 * fix: use repo metadata to populate nodejs CODEOWNERS * fix: use repo metadata to populate nodejs CODEOWNERS * chore: small formatting tweaks Co-authored-by: Benjamin Coe Source-Author: Justin Beckwith Source-Date: Wed Feb 3 15:09:55 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: 318e351e26ba65b2b3cfa3f61b3b64e3540c3525 Source-Link: https://github.com/googleapis/synthtool/commit/318e351e26ba65b2b3cfa3f61b3b64e3540c3525 --- packages/google-cloud-functions/protos/protos.d.ts | 3 ++- packages/google-cloud-functions/protos/protos.js | 7 +++++++ packages/google-cloud-functions/protos/protos.json | 3 ++- packages/google-cloud-functions/synth.metadata | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 1ab3c1949e4..c5ac8aa4b47 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -2631,7 +2631,8 @@ export namespace google { REQUIRED = 2, OUTPUT_ONLY = 3, INPUT_ONLY = 4, - IMMUTABLE = 5 + IMMUTABLE = 5, + UNORDERED_LIST = 6 } /** Properties of a ResourceDescriptor. */ diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index fcd7b704ad1..ea97c0a67ae 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -6291,6 +6291,7 @@ * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value * @property {number} INPUT_ONLY=4 INPUT_ONLY value * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value */ api.FieldBehavior = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -6300,6 +6301,7 @@ values[valuesById[3] = "OUTPUT_ONLY"] = 3; values[valuesById[4] = "INPUT_ONLY"] = 4; values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; return values; })(); @@ -12467,6 +12469,7 @@ case 3: case 4: case 5: + case 6: break; } } @@ -12567,6 +12570,10 @@ case 5: message[".google.api.fieldBehavior"][i] = 5; break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; } } if (object[".google.api.resourceReference"] != null) { diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index 30eb316f43a..a961f4d297e 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -791,7 +791,8 @@ "REQUIRED": 2, "OUTPUT_ONLY": 3, "INPUT_ONLY": 4, - "IMMUTABLE": 5 + "IMMUTABLE": 5, + "UNORDERED_LIST": 6 } }, "resourceReference": { diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 30991ff9b0a..946d3d5da5d 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "98be716d08a5c5b97dfe69d7550036f8510fe06b" + "sha": "4765d966f072fd57a1a1ae7751e9c3c30f9af798" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "363fe305e9ce34a6cd53951c6ee5f997094b54ee" + "sha": "318e351e26ba65b2b3cfa3f61b3b64e3540c3525" } } ], From 1877c09ebac73a6fc52b971ab272a2ce479611ce Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 16 Feb 2021 16:44:56 -0800 Subject: [PATCH 048/123] docs: update sample, regenerate README (#55) --- packages/google-cloud-functions/README.md | 4 +--- .../samples/package.json | 4 +++- .../samples/quickstart.js | 10 ++-------- .../samples/test/quickstart.test.js | 18 +++++++++++------- packages/google-cloud-functions/synth.metadata | 10 +++++----- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index 94df53075a5..94d276c6c37 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -72,9 +72,7 @@ const client = new CloudFunctionsServiceClient(); // project = 'my-project/*/locations/*' // Get the functions for a project. async function listFunctions() { const [functions] = await client.listFunctions({ - parent: project, - pageSize: page_size, - pageToken: page_token, + parent: `projects/${projectId}/locations/-`, }); console.info(functions); } diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 1e9ac02a9f6..ed8341532b8 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -12,7 +12,9 @@ "scripts": { "test": "c8 mocha --timeout 600000 test/*.js" }, - "dependencies": {}, + "dependencies": { + "@google-cloud/functions": "^1.1.2" + }, "devDependencies": { "c8": "^7.1.0", "chai": "^4.2.0", diff --git a/packages/google-cloud-functions/samples/quickstart.js b/packages/google-cloud-functions/samples/quickstart.js index 4f6eaa29675..8c54dfec4e2 100644 --- a/packages/google-cloud-functions/samples/quickstart.js +++ b/packages/google-cloud-functions/samples/quickstart.js @@ -13,11 +13,7 @@ 'use strict'; -async function main( - project = 'projects/my-project/locations/-', // Get the functions for a project. - page_size = 1, //Max number of functions to return per call - page_token = 'token' -) { +async function main(projectId) { // [START cloud_nodejs_functions_quickstart] // Imports the Google Cloud client library @@ -34,9 +30,7 @@ async function main( // project = 'my-project/*/locations/*' // Get the functions for a project. async function listFunctions() { const [functions] = await client.listFunctions({ - parent: project, - pageSize: page_size, - pageToken: page_token, + parent: `projects/${projectId}/locations/-`, }); console.info(functions); } diff --git a/packages/google-cloud-functions/samples/test/quickstart.test.js b/packages/google-cloud-functions/samples/test/quickstart.test.js index fb85b9c8b9e..f341c16be47 100644 --- a/packages/google-cloud-functions/samples/test/quickstart.test.js +++ b/packages/google-cloud-functions/samples/test/quickstart.test.js @@ -20,20 +20,24 @@ const path = require('path'); const {assert} = require('chai'); const cp = require('child_process'); -const {describe, it} = require('mocha'); +const {before, describe, it} = require('mocha'); +const {CloudFunctionsServiceClient} = require('@google-cloud/functions'); +const client = new CloudFunctionsServiceClient(); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); -const project = process.env.GCLOUD_PROJECT; - describe('Quickstart', () => { + let projectId; + + before(async () => { + // eslint-disable-next-line no-unused-vars + projectId = await client.getProjectId(); + }); + it('should run quickstart', async () => { - const stdout = execSync( - `node ./quickstart.js projects/${project}/locations/- 1 token`, - {cwd} - ); + const stdout = execSync(`node ./quickstart.js ${projectId}`, {cwd}); assert(stdout, stdout !== null); }); }); diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 946d3d5da5d..a021bdd5e86 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -3,23 +3,23 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "4765d966f072fd57a1a1ae7751e9c3c30f9af798" + "remote": "git@github.com:googleapis/nodejs-functions.git", + "sha": "af48705e20606cb902b7471237ea84e2feb25ffe" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "d189e871205fea665a9648f7c4676f027495ccaf", - "internalRef": "345596855" + "sha": "5e3dacee19405529b841b53797df799c2383536c", + "internalRef": "355923884" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "318e351e26ba65b2b3cfa3f61b3b64e3540c3525" + "sha": "33366574ffb9e11737b3547eb6f020ecae0536e8" } } ], From 29b8f7277d2551b2745047b28ec60a1aca286691 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 12 Mar 2021 11:26:29 -0800 Subject: [PATCH 049/123] fix: fix service namespace in grpc_service_config. (#56) PiperOrigin-RevId: 360443299 Source-Author: Google APIs Source-Date: Tue Mar 2 09:18:34 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 7cef8809d337ff0d59b1ba11d302e42952e9c3c2 Source-Link: https://github.com/googleapis/googleapis/commit/7cef8809d337ff0d59b1ba11d302e42952e9c3c2 --- .../v1/cloud_functions_service_client_config.json | 14 ++++++++++---- packages/google-cloud-functions/synth.metadata | 8 ++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json b/packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json index 99264b00496..d7b46e523f7 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json @@ -21,26 +21,32 @@ }, "methods": { "ListFunctions": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 600000, + "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetFunction": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 600000, + "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateFunction": { + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "UpdateFunction": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 600000, + "retry_codes_name": "idempotent", "retry_params_name": "default" }, "DeleteFunction": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 600000, + "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CallFunction": { + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index a021bdd5e86..77e0fdb1335 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -3,16 +3,16 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-functions.git", - "sha": "af48705e20606cb902b7471237ea84e2feb25ffe" + "remote": "https://github.com/googleapis/nodejs-functions.git", + "sha": "a57244cdfa50a8959484b90a407aab6b2302e260" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5e3dacee19405529b841b53797df799c2383536c", - "internalRef": "355923884" + "sha": "7cef8809d337ff0d59b1ba11d302e42952e9c3c2", + "internalRef": "360443299" } }, { From c7432fd57b0d99a35b74f8a97d0a9fa2a2b57b41 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 15 Mar 2021 11:46:45 -0700 Subject: [PATCH 050/123] build: update gapic-generator-typescript to v1.2.10. (#58) This update unblocks generating IAM v1 and several more libraries that were previously blocked by their package names. Committer: @alexander-fenster PiperOrigin-RevId: 361273630 Source-Author: Google APIs Source-Date: Fri Mar 5 20:02:38 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 5477122b3e8037a1dc5bc920536158edbd151dc4 Source-Link: https://github.com/googleapis/googleapis/commit/5477122b3e8037a1dc5bc920536158edbd151dc4 --- packages/google-cloud-functions/synth.metadata | 6 +++--- packages/google-cloud-functions/webpack.config.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata index 77e0fdb1335..60714fa81d2 100644 --- a/packages/google-cloud-functions/synth.metadata +++ b/packages/google-cloud-functions/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "a57244cdfa50a8959484b90a407aab6b2302e260" + "sha": "8f5af4a519473ed3fe8fd0761f21b886d3d1c0c9" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "7cef8809d337ff0d59b1ba11d302e42952e9c3c2", - "internalRef": "360443299" + "sha": "5477122b3e8037a1dc5bc920536158edbd151dc4", + "internalRef": "361273630" } }, { diff --git a/packages/google-cloud-functions/webpack.config.js b/packages/google-cloud-functions/webpack.config.js index 51f8b4714eb..acc07c7f7af 100644 --- a/packages/google-cloud-functions/webpack.config.js +++ b/packages/google-cloud-functions/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. From 4cf7e81d35678ece25680e556892380d07664425 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 15 Mar 2021 19:06:02 +0000 Subject: [PATCH 051/123] chore: release 1.1.3 (#57) :robot: I have created a release \*beep\* \*boop\* --- ### [1.1.3](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.2...v1.1.3) (2021-03-15) ### Bug Fixes * fix service namespace in grpc_service_config. ([#56](https://www.github.com/googleapis/nodejs-functions/issues/56)) ([8f5af4a](https://www.github.com/googleapis/nodejs-functions/commit/8f5af4a519473ed3fe8fd0761f21b886d3d1c0c9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index c2acd90b69c..e1f7f5d15f6 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.3](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.2...v1.1.3) (2021-03-15) + + +### Bug Fixes + +* fix service namespace in grpc_service_config. ([#56](https://www.github.com/googleapis/nodejs-functions/issues/56)) ([8f5af4a](https://www.github.com/googleapis/nodejs-functions/commit/8f5af4a519473ed3fe8fd0761f21b886d3d1c0c9)) + ### [1.1.2](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.1...v1.1.2) (2020-11-25) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 7e9c89fb386..51b85b6e9ba 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.2", + "version": "1.1.3", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index ed8341532b8..da6e659b98d 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.1.2" + "@google-cloud/functions": "^1.1.3" }, "devDependencies": { "c8": "^7.1.0", From 3350ed970a4383367250f3424b82fb83cb2b959b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 23 Mar 2021 17:50:24 +0100 Subject: [PATCH 052/123] chore(deps): update dependency sinon to v10 (#59) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^9.0.2` -> `^10.0.0`](https://renovatebot.com/diffs/npm/sinon/9.2.4/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/compatibility-slim/9.2.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/confidence-slim/9.2.4)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v10.0.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1000--2021-03-22) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v9.2.4...v10.0.0) ================== - Upgrade nise to 4.1.0 - Use [@​sinonjs/eslint-config](https://togithub.com/sinonjs/eslint-config)[@​4](https://togithub.com/4) => Adopts ES2017 => Drops support for IE 11, Legacy Edge and legacy Safari
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 51b85b6e9ba..e2c905e3039 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -54,7 +54,7 @@ "mocha": "^8.0.1", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^9.0.2", + "sinon": "^10.0.0", "ts-loader": "^8.0.1", "typescript": "^3.9.7", "webpack": "^5.0.0", From cd732f8232bb7b1f798bb30702e3a31b66efe744 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 14 Apr 2021 23:10:21 +0200 Subject: [PATCH 053/123] chore(deps): update dependency @types/sinon to v10 (#63) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^9.0.4` -> `^10.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/9.0.11/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/compatibility-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/confidence-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index e2c905e3039..754b69c9ceb 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -44,7 +44,7 @@ "devDependencies": { "@types/mocha": "^8.0.0", "@types/node": "^14.0.24", - "@types/sinon": "^9.0.4", + "@types/sinon": "^10.0.0", "c8": "^7.2.1", "gts": "^2.0.2", "jsdoc": "^3.6.4", From 11aa3108459348a33ebfac122b2b8fd6d7907c90 Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Mon, 19 Apr 2021 11:20:45 -0700 Subject: [PATCH 054/123] chore: migrate to owl bot (#61) * chore: migrate to owl bot * chore: copy files from googleapis-gen fb91803ccef5d7c695139b22788b309e2197856b * chore: run the post processor --- .../.github/.OwlBot.yaml | 26 +++++++++++++ .../.repo-metadata.json | 17 +++++---- packages/google-cloud-functions/owlbot.py | 23 ++++++++++++ .../google-cloud-functions/synth.metadata | 37 ------------------- packages/google-cloud-functions/synth.py | 34 ----------------- 5 files changed, 58 insertions(+), 79 deletions(-) create mode 100644 packages/google-cloud-functions/.github/.OwlBot.yaml create mode 100644 packages/google-cloud-functions/owlbot.py delete mode 100644 packages/google-cloud-functions/synth.metadata delete mode 100644 packages/google-cloud-functions/synth.py diff --git a/packages/google-cloud-functions/.github/.OwlBot.yaml b/packages/google-cloud-functions/.github/.OwlBot.yaml new file mode 100644 index 00000000000..688f4f3d502 --- /dev/null +++ b/packages/google-cloud-functions/.github/.OwlBot.yaml @@ -0,0 +1,26 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +docker: + image: gcr.io/repo-automation-bots/owlbot-nodejs:latest + + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/functions/(v.*)/.*-nodejs/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: fb91803ccef5d7c695139b22788b309e2197856b + diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json index 2f5deadd3ee..4cae3bf8c34 100644 --- a/packages/google-cloud-functions/.repo-metadata.json +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -1,14 +1,15 @@ { - "name": "nodejs-functions", - "name_pretty": "Google Cloud Functions", - "product_documentation": "https://cloud.google.com/functions", - "client_documentation": "https://googleapis.dev/nodejs/nodejs-functions/latest/index.html", "issue_tracker": "", - "release_level": "ga", - "language": "nodejs", - "repo": "googleapis/nodejs-functions", "distribution_name": "@google-cloud/functions", + "product_documentation": "https://cloud.google.com/functions", "api_id": "cloudfunctions.googleapis.com", + "client_documentation": "https://googleapis.dev/nodejs/nodejs-functions/latest/index.html", + "repo": "googleapis/nodejs-functions", + "release_level": "ga", "requires_billing": false, - "codeowner_team": "@googleapis/serverless-team" + "name_pretty": "Google Cloud Functions", + "name": "nodejs-functions", + "codeowner_team": "@googleapis/serverless-team", + "default_version": "v1", + "language": "nodejs" } diff --git a/packages/google-cloud-functions/owlbot.py b/packages/google-cloud-functions/owlbot.py new file mode 100644 index 00000000000..61bfcaa6795 --- /dev/null +++ b/packages/google-cloud-functions/owlbot.py @@ -0,0 +1,23 @@ +# 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. +"""This script is used to synthesize generated parts of this library.""" +import synthtool as s +import synthtool.languages.node as node +from pathlib import Path + +def patch(library: Path): + s.replace(library / 'src/v1/cloud_functions_service_client.ts', "function:string", "function_: string") + s.replace(library / 'src/v1/cloud_functions_service_client.ts', "function: function", "function: function_") + +node.owlbot_main(staging_excludes=['README.md', 'package.json'], patch_staging=patch) \ No newline at end of file diff --git a/packages/google-cloud-functions/synth.metadata b/packages/google-cloud-functions/synth.metadata deleted file mode 100644 index 60714fa81d2..00000000000 --- a/packages/google-cloud-functions/synth.metadata +++ /dev/null @@ -1,37 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/nodejs-functions.git", - "sha": "8f5af4a519473ed3fe8fd0761f21b886d3d1c0c9" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5477122b3e8037a1dc5bc920536158edbd151dc4", - "internalRef": "361273630" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "33366574ffb9e11737b3547eb6f020ecae0536e8" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "functions", - "apiVersion": "v1", - "language": "nodejs", - "generator": "bazel" - } - } - ] -} \ No newline at end of file diff --git a/packages/google-cloud-functions/synth.py b/packages/google-cloud-functions/synth.py deleted file mode 100644 index d4c07feffbf..00000000000 --- a/packages/google-cloud-functions/synth.py +++ /dev/null @@ -1,34 +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. -"""This script is used to synthesize generated parts of this library.""" -import synthtool as s -import synthtool.gcp as gcp -import synthtool.languages.node as node -import logging -logging.basicConfig(level=logging.DEBUG) -AUTOSYNTH_MULTIPLE_COMMITS = True -gapic = gcp.GAPICBazel() -versions = ['v1'] -library = 'functions' -for version in versions: - library = gapic.node_library(library, version) - s.copy(library, excludes=['README.md', 'package.json']) -# Copy common templates -common_templates = gcp.CommonTemplates() -templates = common_templates.node_library( - source_location='build/src', versions=['v1'], default_version='v1') -s.copy(templates, excludes=[]) -s.replace('src/v1/cloud_functions_service_client.ts', "function:string", "function_: string") -s.replace('src/v1/cloud_functions_service_client.ts', "function: function", "function: function_") -node.postprocess_gapic_library() \ No newline at end of file From 45a9603ca1028d1e2f5fa27f2d11a396603bbc13 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 20 Apr 2021 00:56:40 +0200 Subject: [PATCH 055/123] chore(deps): update dependency ts-loader to v9 (#66) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ts-loader](https://togithub.com/TypeStrong/ts-loader) | [`^8.0.1` -> `^9.0.0`](https://renovatebot.com/diffs/npm/ts-loader/8.1.0/9.0.0) | [![age](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/compatibility-slim/8.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/confidence-slim/8.1.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
TypeStrong/ts-loader ### [`v9.0.0`](https://togithub.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md#v900) [Compare Source](https://togithub.com/TypeStrong/ts-loader/compare/v8.1.0...v9.0.0) Breaking changes: - minimum webpack version: 5 - minimum node version: 12 Changes: - [webpack 5 migration](https://togithub.com/TypeStrong/ts-loader/pull/1251) - thanks [@​johnnyreilly](https://togithub.com/johnnyreilly), [@​jonwallsten](https://togithub.com/jonwallsten), [@​sokra](https://togithub.com/sokra), [@​appzuka](https://togithub.com/appzuka), [@​alexander-akait](https://togithub.com/alexander-akait)
--- ### Configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 754b69c9ceb..f8160fb45db 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -55,7 +55,7 @@ "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^10.0.0", - "ts-loader": "^8.0.1", + "ts-loader": "^9.0.0", "typescript": "^3.9.7", "webpack": "^5.0.0", "webpack-cli": "^4.0.0" From 3aedd98389635d1a907f2b1640ed72bc6bb0e4da Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 6 May 2021 17:50:06 -0700 Subject: [PATCH 056/123] fix(deps): require google-gax v2.12.0 (#70) --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index f8160fb45db..aab55243e99 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,7 +39,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^2.9.2" + "google-gax": "^2.12.0" }, "devDependencies": { "@types/mocha": "^8.0.0", From 243f29dfdc45d00cabd1c393057a41337ae88346 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 17:00:54 +0000 Subject: [PATCH 057/123] chore: new owl bot post processor docker image (#72) gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f --- .../google-cloud-functions/protos/protos.d.ts | 14 +- .../google-cloud-functions/protos/protos.js | 28 +- .../src/v1/cloud_functions_service_client.ts | 134 ++--- .../system-test/fixtures/sample/src/index.js | 3 +- .../test/gapic_cloud_functions_service_v1.ts | 521 ++++++++---------- 5 files changed, 306 insertions(+), 394 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index c5ac8aa4b47..eb2d69cfda8 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -370,13 +370,13 @@ export namespace google { public description: string; /** CloudFunction sourceArchiveUrl. */ - public sourceArchiveUrl: string; + public sourceArchiveUrl?: (string|null); /** CloudFunction sourceRepository. */ public sourceRepository?: (google.cloud.functions.v1.ISourceRepository|null); /** CloudFunction sourceUploadUrl. */ - public sourceUploadUrl: string; + public sourceUploadUrl?: (string|null); /** CloudFunction httpsTrigger. */ public httpsTrigger?: (google.cloud.functions.v1.IHttpsTrigger|null); @@ -2428,19 +2428,19 @@ export namespace google { public selector: string; /** HttpRule get. */ - public get: string; + public get?: (string|null); /** HttpRule put. */ - public put: string; + public put?: (string|null); /** HttpRule post. */ - public post: string; + public post?: (string|null); /** HttpRule delete. */ - public delete: string; + public delete?: (string|null); /** HttpRule patch. */ - public patch: string; + public patch?: (string|null); /** HttpRule custom. */ public custom?: (google.api.ICustomHttpPattern|null); diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index ea97c0a67ae..d9466870e3b 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -530,11 +530,11 @@ /** * CloudFunction sourceArchiveUrl. - * @member {string} sourceArchiveUrl + * @member {string|null|undefined} sourceArchiveUrl * @memberof google.cloud.functions.v1.CloudFunction * @instance */ - CloudFunction.prototype.sourceArchiveUrl = ""; + CloudFunction.prototype.sourceArchiveUrl = null; /** * CloudFunction sourceRepository. @@ -546,11 +546,11 @@ /** * CloudFunction sourceUploadUrl. - * @member {string} sourceUploadUrl + * @member {string|null|undefined} sourceUploadUrl * @memberof google.cloud.functions.v1.CloudFunction * @instance */ - CloudFunction.prototype.sourceUploadUrl = ""; + CloudFunction.prototype.sourceUploadUrl = null; /** * CloudFunction httpsTrigger. @@ -5652,43 +5652,43 @@ /** * HttpRule get. - * @member {string} get + * @member {string|null|undefined} get * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.get = ""; + HttpRule.prototype.get = null; /** * HttpRule put. - * @member {string} put + * @member {string|null|undefined} put * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.put = ""; + HttpRule.prototype.put = null; /** * HttpRule post. - * @member {string} post + * @member {string|null|undefined} post * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.post = ""; + HttpRule.prototype.post = null; /** * HttpRule delete. - * @member {string} delete + * @member {string|null|undefined} delete * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype["delete"] = ""; + HttpRule.prototype["delete"] = null; /** * HttpRule patch. - * @member {string} patch + * @member {string|null|undefined} patch * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.patch = ""; + HttpRule.prototype.patch = null; /** * HttpRule custom. diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 2cfe7dcffba..f1370a4e2b1 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -301,13 +301,14 @@ export class CloudFunctionsServiceClient { ]; for (const methodName of cloudFunctionsServiceStubMethods) { const callPromise = this.cloudFunctionsServiceStub.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); - }, + 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; } @@ -460,11 +461,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getFunction(request, options, callback); } @@ -551,11 +551,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.callFunction(request, options, callback); } @@ -668,11 +667,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.generateUploadUrl(request, options, callback); } @@ -768,11 +766,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.generateDownloadUrl(request, options, callback); } @@ -859,11 +856,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } @@ -949,11 +945,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } @@ -1042,11 +1037,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); } @@ -1153,11 +1147,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - location: request.location || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + location: request.location || '', + }); this.initialize(); return this.innerApiCalls.createFunction(request, options, callback); } @@ -1297,11 +1290,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'function.name': request.function!.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'function.name': request.function!.name || '', + }); this.initialize(); return this.innerApiCalls.updateFunction(request, options, callback); } @@ -1441,11 +1433,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteFunction(request, options, callback); } @@ -1585,11 +1576,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listFunctions(request, options, callback); } @@ -1632,11 +1622,10 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listFunctions.createStream( @@ -1690,17 +1679,16 @@ export class CloudFunctionsServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listFunctions.asyncIterate( this.innerApiCalls['listFunctions'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js index 8c4ce42d642..d149eeb5715 100644 --- a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js @@ -20,7 +20,8 @@ const functions = require('@google-cloud/functions'); function main() { - const cloudFunctionsServiceClient = new functions.CloudFunctionsServiceClient(); + const cloudFunctionsServiceClient = + new functions.CloudFunctionsServiceClient(); } main(); diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index 1c811552194..e3960838a71 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + 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; @@ -166,49 +165,46 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('should create a client with no option', () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ fallback: true, - } - ); + }); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); assert.strictEqual(client.cloudFunctionsServiceStub, undefined); await client.initialize(); assert(client.cloudFunctionsServiceStub); }); it('has close method', () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ 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); @@ -217,12 +213,11 @@ describe('v1.CloudFunctionsServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -241,12 +236,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('getFunction', () => { it('invokes getFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GetFunctionRequest() @@ -274,12 +268,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes getFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GetFunctionRequest() @@ -296,9 +289,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.CloudFunction() ); - client.innerApiCalls.getFunction = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getFunction = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getFunction( request, @@ -324,12 +316,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes getFunction with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GetFunctionRequest() @@ -359,12 +350,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('callFunction', () => { it('invokes callFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionRequest() @@ -392,12 +382,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes callFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionRequest() @@ -414,9 +403,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionResponse() ); - client.innerApiCalls.callFunction = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.callFunction = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.callFunction( request, @@ -442,12 +430,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes callFunction with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionRequest() @@ -477,12 +464,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('generateUploadUrl', () => { it('invokes generateUploadUrl without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() @@ -510,12 +496,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes generateUploadUrl without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() @@ -532,9 +517,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() ); - client.innerApiCalls.generateUploadUrl = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.generateUploadUrl = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.generateUploadUrl( request, @@ -560,12 +544,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes generateUploadUrl with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() @@ -595,12 +578,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('generateDownloadUrl', () => { it('invokes generateDownloadUrl without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() @@ -617,9 +599,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); const [response] = await client.generateDownloadUrl(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -630,12 +611,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes generateDownloadUrl without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() @@ -652,9 +632,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() ); - client.innerApiCalls.generateDownloadUrl = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.generateDownloadUrl( request, @@ -680,12 +659,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes generateDownloadUrl with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() @@ -715,12 +693,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('setIamPolicy', () => { it('invokes setIamPolicy without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() @@ -748,12 +725,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes setIamPolicy without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() @@ -770,9 +746,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.setIamPolicy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.setIamPolicy( request, @@ -798,12 +773,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes setIamPolicy with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() @@ -833,12 +807,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('getIamPolicy', () => { it('invokes getIamPolicy without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() @@ -866,12 +839,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes getIamPolicy without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() @@ -888,9 +860,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getIamPolicy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getIamPolicy( request, @@ -916,12 +887,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes getIamPolicy with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() @@ -951,12 +921,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('testIamPermissions', () => { it('invokes testIamPermissions without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() @@ -973,9 +942,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsResponse() ); - client.innerApiCalls.testIamPermissions = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.testIamPermissions = + stubSimpleCall(expectedResponse); const [response] = await client.testIamPermissions(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -986,12 +954,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes testIamPermissions without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() @@ -1008,9 +975,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsResponse() ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.testIamPermissions = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.testIamPermissions( request, @@ -1036,12 +1002,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes testIamPermissions with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() @@ -1071,12 +1036,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('createFunction', () => { it('invokes createFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.CreateFunctionRequest() @@ -1093,9 +1057,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createFunction = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createFunction = + stubLongRunningCall(expectedResponse); const [operation] = await client.createFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1107,12 +1070,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes createFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.CreateFunctionRequest() @@ -1129,9 +1091,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createFunction = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createFunction = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createFunction( request, @@ -1164,12 +1125,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes createFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.CreateFunctionRequest() @@ -1197,12 +1157,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes createFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.CreateFunctionRequest() @@ -1232,12 +1191,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes checkCreateFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -1256,12 +1214,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes checkCreateFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -1279,12 +1236,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('updateFunction', () => { it('invokes updateFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.UpdateFunctionRequest() @@ -1302,9 +1258,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateFunction = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); const [operation] = await client.updateFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1316,12 +1271,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes updateFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.UpdateFunctionRequest() @@ -1339,9 +1293,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateFunction = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateFunction = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateFunction( request, @@ -1374,12 +1327,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes updateFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.UpdateFunctionRequest() @@ -1408,12 +1360,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes updateFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.UpdateFunctionRequest() @@ -1444,12 +1395,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes checkUpdateFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -1468,12 +1418,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes checkUpdateFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -1491,12 +1440,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('deleteFunction', () => { it('invokes deleteFunction without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.DeleteFunctionRequest() @@ -1513,9 +1461,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteFunction = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteFunction = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -1527,12 +1474,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes deleteFunction without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.DeleteFunctionRequest() @@ -1549,9 +1495,8 @@ describe('v1.CloudFunctionsServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteFunction = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteFunction = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteFunction( request, @@ -1584,12 +1529,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes deleteFunction with call error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.DeleteFunctionRequest() @@ -1617,12 +1561,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes deleteFunction with LRO error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.DeleteFunctionRequest() @@ -1652,12 +1595,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes checkDeleteFunctionProgress without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -1676,12 +1618,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes checkDeleteFunctionProgress with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); @@ -1699,12 +1640,11 @@ describe('v1.CloudFunctionsServiceClient', () => { describe('listFunctions', () => { it('invokes listFunctions without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() @@ -1740,12 +1680,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes listFunctions without error using callback', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() @@ -1770,9 +1709,8 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.cloud.functions.v1.CloudFunction() ), ]; - client.innerApiCalls.listFunctions = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listFunctions = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listFunctions( request, @@ -1798,12 +1736,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes listFunctions with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() @@ -1831,12 +1768,11 @@ describe('v1.CloudFunctionsServiceClient', () => { }); it('invokes listFunctionsStream without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() @@ -1854,9 +1790,8 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.cloud.functions.v1.CloudFunction() ), ]; - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listFunctionsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; @@ -1881,21 +1816,19 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(client.innerApiCalls.listFunctions, request) ); assert.strictEqual( - (client.descriptors.page.listFunctions - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('invokes listFunctionsStream with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() @@ -1903,10 +1836,8 @@ describe('v1.CloudFunctionsServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listFunctionsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.functions.v1.CloudFunction[] = []; @@ -1930,21 +1861,19 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(client.innerApiCalls.listFunctions, request) ); assert.strictEqual( - (client.descriptors.page.listFunctions - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('uses async iteration with listFunctions without error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() @@ -1962,9 +1891,8 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.cloud.functions.v1.CloudFunction() ), ]; - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; const iterable = client.listFunctionsAsync(request); for await (const resource of iterable) { @@ -1972,26 +1900,25 @@ describe('v1.CloudFunctionsServiceClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listFunctions - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listFunctions - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('uses async iteration with listFunctions with error', async () => { - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() @@ -1999,10 +1926,8 @@ describe('v1.CloudFunctionsServiceClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listFunctionsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.functions.v1.ICloudFunction[] = []; @@ -2011,15 +1936,15 @@ describe('v1.CloudFunctionsServiceClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listFunctions - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listFunctions - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -2033,12 +1958,11 @@ describe('v1.CloudFunctionsServiceClient', () => { location: 'locationValue', function: 'functionValue', }; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.cloudFunctionPathTemplate.render = sinon .stub() @@ -2098,12 +2022,11 @@ describe('v1.CloudFunctionsServiceClient', () => { project: 'projectValue', location: 'locationValue', }; - const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient( - { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.locationPathTemplate.render = sinon .stub() From 29384aeef8f5d87676e2151efefdcf00e89b9e0f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 21:56:15 +0000 Subject: [PATCH 058/123] fix: use require() to load JSON protos (#73) The library is regenerated with gapic-generator-typescript v1.3.1. Committer: @alexander-fenster PiperOrigin-RevId: 372468161 Source-Link: https://github.com/googleapis/googleapis/commit/75880c3e6a6aa2597400582848e81bbbfac51dea Source-Link: https://github.com/googleapis/googleapis-gen/commit/77b18044813d4c8c415ff9ea68e76e307eb8e904 --- .../src/v1/cloud_functions_service_client.ts | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index f1370a4e2b1..1e3e1f35a48 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -32,6 +32,7 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v1/cloud_functions_service_client_config.json`. @@ -148,22 +149,7 @@ export class CloudFunctionsServiceClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. @@ -188,15 +174,11 @@ export class CloudFunctionsServiceClient { ), }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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 protoFilesRoot = opts.fallback - ? this._gaxModule.protobuf.Root.fromJSON( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - ) - : this._gaxModule.protobuf.loadSync(nodejsProtoPath); this.operationsClient = this._gaxModule .lro({ From c1683751f2b69ee2e2d22ea09d38e76b10e3ff1b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 23:12:22 +0000 Subject: [PATCH 059/123] chore: update gapic-generator-typescript to v1.3.2 (#74) Committer: @alexander-fenster PiperOrigin-RevId: 372656503 Source-Link: https://github.com/googleapis/googleapis/commit/6fa858c6489b1bbc505a7d7afe39f2dc45819c38 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d7c95df3ab1ea1b4c22a4542bad4924cc46d1388 --- .../src/v1/cloud_functions_service_client.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 1e3e1f35a48..daa10fbd770 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -27,7 +27,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; -import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; From a9c6ffeb8da13b4a298fcc6b491d0a5ce21a6d60 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 13 May 2021 10:33:51 -0700 Subject: [PATCH 060/123] chore: release 1.1.4 (#71) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-functions/CHANGELOG.md | 8 ++++++++ packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index e1f7f5d15f6..8bb5c70b603 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [1.1.4](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.3...v1.1.4) (2021-05-12) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#70](https://www.github.com/googleapis/nodejs-functions/issues/70)) ([0369f0c](https://www.github.com/googleapis/nodejs-functions/commit/0369f0cdf8424a531861b3ad65b10215d293b74d)) +* use require() to load JSON protos ([#73](https://www.github.com/googleapis/nodejs-functions/issues/73)) ([b3da62e](https://www.github.com/googleapis/nodejs-functions/commit/b3da62e5a46628f91615854fc8fa61f315ab1ff9)) + ### [1.1.3](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.2...v1.1.3) (2021-03-15) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index aab55243e99..5f742483611 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.3", + "version": "1.1.4", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index da6e659b98d..d70dbb3c64f 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.1.3" + "@google-cloud/functions": "^1.1.4" }, "devDependencies": { "c8": "^7.1.0", From cce52fa9075bf2046d42ba223ee2ef4f661e644d Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 25 May 2021 17:58:26 +0200 Subject: [PATCH 061/123] chore(deps): update dependency sinon to v11 (#77) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^10.0.0` -> `^11.0.0`](https://renovatebot.com/diffs/npm/sinon/10.0.0/11.1.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/compatibility-slim/10.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/confidence-slim/10.0.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v11.1.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1110--2021-05-25) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v11.0.0...31be9a5d5a4762ef01cb195f29024616dfee9ce8) \================== - Add sinon.promise() implementation ([#​2369](https://togithub.com/sinonjs/sinon/issues/2369)) - Set wrappedMethod on getters/setters ([#​2378](https://togithub.com/sinonjs/sinon/issues/2378)) - \[Docs] Update fake-server usage & descriptions ([#​2365](https://togithub.com/sinonjs/sinon/issues/2365)) - Fake docs improvement ([#​2360](https://togithub.com/sinonjs/sinon/issues/2360)) - Update nise to 5.1.0 (fixed [#​2318](https://togithub.com/sinonjs/sinon/issues/2318)) ### [`v11.0.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1100--2021-05-24) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v10.0.1...v11.0.0) \================== - Explicitly use samsam 6.0.2 with fix for [#​2345](https://togithub.com/sinonjs/sinon/issues/2345) - Update most packages ([#​2371](https://togithub.com/sinonjs/sinon/issues/2371)) - Update compatibility docs ([#​2366](https://togithub.com/sinonjs/sinon/issues/2366)) - Update packages (includes breaking fake-timers change, see [#​2352](https://togithub.com/sinonjs/sinon/issues/2352)) - Warn of potential memory leaks ([#​2357](https://togithub.com/sinonjs/sinon/issues/2357)) - Fix clock test errors ### [`v10.0.1`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1001--2021-04-08) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v10.0.0...v10.0.1) \================== - Upgrade sinon components (bumps y18n to 4.0.1) - Bump y18n from 4.0.0 to 4.0.1
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 5f742483611..1c39e3e550b 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -54,7 +54,7 @@ "mocha": "^8.0.1", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^10.0.0", + "sinon": "^11.0.0", "ts-loader": "^9.0.0", "typescript": "^3.9.7", "webpack": "^5.0.0", From a4e7a18b6e82b39f8246d8737883adda55eb689a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 May 2021 20:48:17 +0000 Subject: [PATCH 062/123] fix: GoogleAdsError missing using generator version after 1.3.0 (#78) [PR](https://github.com/googleapis/gapic-generator-typescript/pull/878) within updated gapic-generator-typescript version 1.4.0 Committer: @summer-ji-eng PiperOrigin-RevId: 375759421 Source-Link: https://github.com/googleapis/googleapis/commit/95fa72fdd0d69b02d72c33b37d1e4cc66d4b1446 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f40a34377ad488a7c2bc3992b3c8d5faf5a15c46 --- .../src/v1/cloud_functions_service_client.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index daa10fbd770..68c21a0c44c 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -143,6 +143,8 @@ export class CloudFunctionsServiceClient { } 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}`); From a344882dd44ef603a15380f0fccbd8dde4eeddf4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 7 Jun 2021 13:26:29 -0700 Subject: [PATCH 063/123] chore: release 1.1.5 (#79) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 8bb5c70b603..b7e77cee202 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.5](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.4...v1.1.5) (2021-06-07) + + +### Bug Fixes + +* GoogleAdsError missing using generator version after 1.3.0 ([#78](https://www.github.com/googleapis/nodejs-functions/issues/78)) ([4c413d8](https://www.github.com/googleapis/nodejs-functions/commit/4c413d8e199cfe5e4e6d1f9144b44fea1a98d59d)) + ### [1.1.4](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.3...v1.1.4) (2021-05-12) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 1c39e3e550b..aab64e0cadd 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.4", + "version": "1.1.5", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index d70dbb3c64f..237b244fad7 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.1.4" + "@google-cloud/functions": "^1.1.5" }, "devDependencies": { "c8": "^7.1.0", From e60a33803a98229ffd7906ab94aedede36ffe7ab Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 23 Jun 2021 16:28:13 +0000 Subject: [PATCH 064/123] fix: make request optional in all cases (#85) ... chore: update gapic-generator-ruby to the latest commit chore: release gapic-generator-typescript 1.5.0 Committer: @miraleung PiperOrigin-RevId: 380641501 Source-Link: https://github.com/googleapis/googleapis/commit/076f7e9f0b258bdb54338895d7251b202e8f0de3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/27e4c88b4048e5f56508d4e1aa417d60a3380892 --- .../src/v1/cloud_functions_service_client.ts | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 68c21a0c44c..0f21666994a 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -367,7 +367,7 @@ export class CloudFunctionsServiceClient { // -- Service calls -- // ------------------- getFunction( - request: protos.google.cloud.functions.v1.IGetFunctionRequest, + request?: protos.google.cloud.functions.v1.IGetFunctionRequest, options?: CallOptions ): Promise< [ @@ -411,7 +411,7 @@ export class CloudFunctionsServiceClient { * const [response] = await client.getFunction(request); */ getFunction( - request: protos.google.cloud.functions.v1.IGetFunctionRequest, + request?: protos.google.cloud.functions.v1.IGetFunctionRequest, optionsOrCallback?: | CallOptions | Callback< @@ -452,7 +452,7 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.getFunction(request, options, callback); } callFunction( - request: protos.google.cloud.functions.v1.ICallFunctionRequest, + request?: protos.google.cloud.functions.v1.ICallFunctionRequest, options?: CallOptions ): Promise< [ @@ -501,7 +501,7 @@ export class CloudFunctionsServiceClient { * const [response] = await client.callFunction(request); */ callFunction( - request: protos.google.cloud.functions.v1.ICallFunctionRequest, + request?: protos.google.cloud.functions.v1.ICallFunctionRequest, optionsOrCallback?: | CallOptions | Callback< @@ -542,7 +542,7 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.callFunction(request, options, callback); } generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, options?: CallOptions ): Promise< [ @@ -615,7 +615,7 @@ export class CloudFunctionsServiceClient { * const [response] = await client.generateUploadUrl(request); */ generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, optionsOrCallback?: | CallOptions | Callback< @@ -658,7 +658,7 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.generateUploadUrl(request, options, callback); } generateDownloadUrl( - request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, options?: CallOptions ): Promise< [ @@ -714,7 +714,7 @@ export class CloudFunctionsServiceClient { * const [response] = await client.generateDownloadUrl(request); */ generateDownloadUrl( - request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, optionsOrCallback?: | CallOptions | Callback< @@ -757,7 +757,7 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.generateDownloadUrl(request, options, callback); } setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, + request?: protos.google.iam.v1.ISetIamPolicyRequest, options?: CallOptions ): Promise< [ @@ -808,7 +808,7 @@ export class CloudFunctionsServiceClient { * const [response] = await client.setIamPolicy(request); */ setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, + request?: protos.google.iam.v1.ISetIamPolicyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -847,7 +847,7 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.setIamPolicy(request, options, callback); } getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, + request?: protos.google.iam.v1.IGetIamPolicyRequest, options?: CallOptions ): Promise< [ @@ -897,7 +897,7 @@ export class CloudFunctionsServiceClient { * const [response] = await client.getIamPolicy(request); */ getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, + request?: protos.google.iam.v1.IGetIamPolicyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -936,7 +936,7 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.getIamPolicy(request, options, callback); } testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, + request?: protos.google.iam.v1.ITestIamPermissionsRequest, options?: CallOptions ): Promise< [ @@ -989,7 +989,7 @@ export class CloudFunctionsServiceClient { * const [response] = await client.testIamPermissions(request); */ testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, + request?: protos.google.iam.v1.ITestIamPermissionsRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1029,7 +1029,7 @@ export class CloudFunctionsServiceClient { } createFunction( - request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, options?: CallOptions ): Promise< [ @@ -1090,7 +1090,7 @@ export class CloudFunctionsServiceClient { * const [response] = await operation.promise(); */ createFunction( - request: protos.google.cloud.functions.v1.ICreateFunctionRequest, + request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1175,7 +1175,7 @@ export class CloudFunctionsServiceClient { >; } updateFunction( - request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, options?: CallOptions ): Promise< [ @@ -1233,7 +1233,7 @@ export class CloudFunctionsServiceClient { * const [response] = await operation.promise(); */ updateFunction( - request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, + request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1318,7 +1318,7 @@ export class CloudFunctionsServiceClient { >; } deleteFunction( - request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, options?: CallOptions ): Promise< [ @@ -1376,7 +1376,7 @@ export class CloudFunctionsServiceClient { * const [response] = await operation.promise(); */ deleteFunction( - request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, + request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1461,7 +1461,7 @@ export class CloudFunctionsServiceClient { >; } listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, options?: CallOptions ): Promise< [ @@ -1524,7 +1524,7 @@ export class CloudFunctionsServiceClient { * for more details and examples. */ listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< From bde4a87052e96c030dda6abf0b2eebebc8b5dc17 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 25 Jun 2021 09:20:25 -0700 Subject: [PATCH 065/123] chore: release 1.1.6 (#86) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index b7e77cee202..0d3a90d0751 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.6](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.5...v1.1.6) (2021-06-24) + + +### Bug Fixes + +* make request optional in all cases ([#85](https://www.github.com/googleapis/nodejs-functions/issues/85)) ([16b60eb](https://www.github.com/googleapis/nodejs-functions/commit/16b60eb08129f4da404970ba9b487770c1e8c9e8)) + ### [1.1.5](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.4...v1.1.5) (2021-06-07) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index aab64e0cadd..1cdc3370e13 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.5", + "version": "1.1.6", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 237b244fad7..5f7a39f341d 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.1.5" + "@google-cloud/functions": "^1.1.6" }, "devDependencies": { "c8": "^7.1.0", From 9eb2a8d955d35612583ee02a02b35e9de27f2952 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 29 Jun 2021 11:24:49 -0400 Subject: [PATCH 066/123] fix(deps): google-gax v2.17.0 with mTLS (#89) --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 1cdc3370e13..b68be211f91 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,7 +39,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^2.12.0" + "google-gax": "^2.17.0" }, "devDependencies": { "@types/mocha": "^8.0.0", From b5974a8df38be559aa7f76549f0625f17703320f Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 12 Jul 2021 17:46:22 -0400 Subject: [PATCH 067/123] fix(deps): google-gax v2.17.1 (#92) --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index b68be211f91..939fffea280 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,7 +39,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^2.17.0" + "google-gax": "^2.17.1" }, "devDependencies": { "@types/mocha": "^8.0.0", From 8776462b51784ca4507c9b97e7ed580a2b95e329 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 22:20:34 +0000 Subject: [PATCH 068/123] chore: release 1.1.7 (#90) :robot: I have created a release \*beep\* \*boop\* --- ### [1.1.7](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.6...v1.1.7) (2021-07-12) ### Bug Fixes * **deps:** google-gax v2.17.0 with mTLS ([#89](https://www.github.com/googleapis/nodejs-functions/issues/89)) ([2beef03](https://www.github.com/googleapis/nodejs-functions/commit/2beef033c8c134d812e05f12186c7d1285f7e70b)) * **deps:** google-gax v2.17.1 ([#92](https://www.github.com/googleapis/nodejs-functions/issues/92)) ([4024ee5](https://www.github.com/googleapis/nodejs-functions/commit/4024ee5bebfdd8d2fb1c7a3431906773e2510d5b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-functions/CHANGELOG.md | 8 ++++++++ packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 0d3a90d0751..dc8e5a71838 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [1.1.7](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.6...v1.1.7) (2021-07-12) + + +### Bug Fixes + +* **deps:** google-gax v2.17.0 with mTLS ([#89](https://www.github.com/googleapis/nodejs-functions/issues/89)) ([2beef03](https://www.github.com/googleapis/nodejs-functions/commit/2beef033c8c134d812e05f12186c7d1285f7e70b)) +* **deps:** google-gax v2.17.1 ([#92](https://www.github.com/googleapis/nodejs-functions/issues/92)) ([4024ee5](https://www.github.com/googleapis/nodejs-functions/commit/4024ee5bebfdd8d2fb1c7a3431906773e2510d5b)) + ### [1.1.6](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.5...v1.1.6) (2021-06-24) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 939fffea280..183babe68f8 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.6", + "version": "1.1.7", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 5f7a39f341d..5d9c32e9f8f 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.1.6" + "@google-cloud/functions": "^1.1.7" }, "devDependencies": { "c8": "^7.1.0", From ab926513c04b4c71d1de7506e45d6748554a6541 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 19:08:42 +0000 Subject: [PATCH 069/123] fix: Updating WORKSPACE files to use the newest version of the Typescript generator. (#93) Also removing the explicit generator tag for the IAMPolicy mixin for the kms and pubsub APIS as the generator will now read it from the .yaml file. PiperOrigin-RevId: 385101839 Source-Link: https://github.com/googleapis/googleapis/commit/80f404215a9346259db760d80d0671f28c433453 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d3509d2520fb8db862129633f1cf8406d17454e1 --- .../src/v1/cloud_functions_service_client.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 0f21666994a..d0f3895ff57 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -49,6 +49,7 @@ const version = require('../../../package.json').version; export class CloudFunctionsServiceClient { 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: {}; @@ -60,6 +61,7 @@ export class CloudFunctionsServiceClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -105,6 +107,9 @@ export class CloudFunctionsServiceClient { .constructor as typeof CloudFunctionsServiceClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -236,6 +241,9 @@ export class CloudFunctionsServiceClient { // 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 = gax.warn; } /** @@ -264,7 +272,8 @@ export class CloudFunctionsServiceClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.functions.v1.CloudFunctionsService, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides From 36398af496182d3c3dc5d0decbf9fb1de1c50610 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 21 Jul 2021 00:30:15 +0000 Subject: [PATCH 070/123] chore: release 1.1.8 (#94) :robot: I have created a release \*beep\* \*boop\* --- ### [1.1.8](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.7...v1.1.8) (2021-07-21) ### Bug Fixes * Updating WORKSPACE files to use the newest version of the Typescript generator. ([#93](https://www.github.com/googleapis/nodejs-functions/issues/93)) ([6125f4f](https://www.github.com/googleapis/nodejs-functions/commit/6125f4fe7846f67e4ad436b63d4914a2175f9672)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index dc8e5a71838..6eb06e11481 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.8](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.7...v1.1.8) (2021-07-21) + + +### Bug Fixes + +* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#93](https://www.github.com/googleapis/nodejs-functions/issues/93)) ([6125f4f](https://www.github.com/googleapis/nodejs-functions/commit/6125f4fe7846f67e4ad436b63d4914a2175f9672)) + ### [1.1.7](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.6...v1.1.7) (2021-07-12) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 183babe68f8..dc7b915149c 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.7", + "version": "1.1.8", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 5d9c32e9f8f..3238692524b 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.1.7" + "@google-cloud/functions": "^1.1.8" }, "devDependencies": { "c8": "^7.1.0", From 1ba694170f17957774e37b67ed32d89c94b3e112 Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Wed, 4 Aug 2021 16:00:47 -0400 Subject: [PATCH 071/123] chore(nodejs): update client ref docs link in metadata (#99) --- packages/google-cloud-functions/.repo-metadata.json | 2 +- packages/google-cloud-functions/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json index 4cae3bf8c34..3a164dd5c6d 100644 --- a/packages/google-cloud-functions/.repo-metadata.json +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -3,7 +3,7 @@ "distribution_name": "@google-cloud/functions", "product_documentation": "https://cloud.google.com/functions", "api_id": "cloudfunctions.googleapis.com", - "client_documentation": "https://googleapis.dev/nodejs/nodejs-functions/latest/index.html", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/functions/latest", "repo": "googleapis/nodejs-functions", "release_level": "ga", "requires_billing": false, diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index 94d276c6c37..49eefc582b6 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -151,7 +151,7 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-functions/blob/master/LICENSE) -[client-docs]: https://googleapis.dev/nodejs/nodejs-functions/latest/index.html +[client-docs]: https://cloud.google.com/nodejs/docs/reference/functions/latest [product-docs]: https://cloud.google.com/functions [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project From d146051abfad51e075adfeb63f39b2ed3724af77 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 6 Aug 2021 12:00:15 -0700 Subject: [PATCH 072/123] fix: updating behavior of source_upload_url during Get/List function calls (#100) --- .../protos/google/cloud/functions/v1/functions.proto | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto index aa3dd5de6ab..6523c7db434 100644 --- a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. @@ -243,7 +243,11 @@ message CloudFunction { SourceRepository source_repository = 4; // The Google Cloud Storage signed URL used for source uploading, generated - // by [google.cloud.functions.v1.GenerateUploadUrl][] + // by calling [google.cloud.functions.v1.GenerateUploadUrl]. + // + // The signature is validated on write methods {Create, Update} + // The signature is stripped from the Function object on read methods {Get, + // List} string source_upload_url = 16; } From 8f59aded498f1af4dd15f099712a663a699fd9d5 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Sat, 14 Aug 2021 00:42:15 -0700 Subject: [PATCH 073/123] fix(build): migrate to using main branch (#103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(build): migrate to using main branch * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- packages/google-cloud-functions/README.md | 16 ++++++++-------- .../google-cloud-functions/samples/README.md | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index 49eefc582b6..1c41a2b512c 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -6,7 +6,7 @@ [![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/functions.svg)](https://www.npmjs.org/package/@google-cloud/functions) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-functions/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-functions) +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-functions/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-functions) @@ -15,7 +15,7 @@ Functions client for Node.js A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/nodejs-functions/blob/master/CHANGELOG.md). +[the CHANGELOG](https://github.com/googleapis/nodejs-functions/blob/main/CHANGELOG.md). * [Google Cloud Functions Node.js Client API Reference][client-docs] * [Google Cloud Functions Documentation][product-docs] @@ -84,11 +84,11 @@ listFunctions(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-functions/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-functions/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Quickstart | [source code](https://github.com/googleapis/nodejs-functions/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-functions&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/nodejs-functions/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-functions&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | @@ -137,19 +137,19 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-functions/blob/master/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-functions/blob/main/CONTRIBUTING.md). Please note that this `README.md`, the `samples/README.md`, and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) are generated from a central template. To edit one of these files, make an edit -to its template in this -[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). +to its templates in +[directory](https://github.com/googleapis/synthtool). ## License Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/nodejs-functions/blob/master/LICENSE) +See [LICENSE](https://github.com/googleapis/nodejs-functions/blob/main/LICENSE) [client-docs]: https://cloud.google.com/nodejs/docs/reference/functions/latest [product-docs]: https://cloud.google.com/functions diff --git a/packages/google-cloud-functions/samples/README.md b/packages/google-cloud-functions/samples/README.md index b751c1fa974..9b4c892afb1 100644 --- a/packages/google-cloud-functions/samples/README.md +++ b/packages/google-cloud-functions/samples/README.md @@ -31,7 +31,7 @@ Before running the samples, make sure you've followed the steps outlined in ### Quickstart -View the [source code](https://github.com/googleapis/nodejs-functions/blob/master/samples/quickstart.js). +View the [source code](https://github.com/googleapis/nodejs-functions/blob/main/samples/quickstart.js). [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-functions&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) From ebf7be1725de3e2f6b0a9fc26a9a0d662f95bb7a Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 16 Aug 2021 22:48:12 -0400 Subject: [PATCH 074/123] fix(deps): google-gax v2.24.1 (#104) --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index dc7b915149c..4af782204e5 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,7 +39,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^2.17.1" + "google-gax": "^2.24.1" }, "devDependencies": { "@types/mocha": "^8.0.0", From bfa84e88af83ca75b716ef70fa28d699efda4433 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 17:06:38 +0000 Subject: [PATCH 075/123] chore: release 1.1.9 (#101) :robot: I have created a release \*beep\* \*boop\* --- ### [1.1.9](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.8...v1.1.9) (2021-08-17) ### Bug Fixes * **build:** migrate to using main branch ([#103](https://www.github.com/googleapis/nodejs-functions/issues/103)) ([e1955e9](https://www.github.com/googleapis/nodejs-functions/commit/e1955e905b7b4128816bb778450cf60a11ae4b78)) * **deps:** google-gax v2.24.1 ([#104](https://www.github.com/googleapis/nodejs-functions/issues/104)) ([a419fa4](https://www.github.com/googleapis/nodejs-functions/commit/a419fa46a2056de455989ee8af577fed01ed8fc3)) * updating behavior of source_upload_url during Get/List function calls ([#100](https://www.github.com/googleapis/nodejs-functions/issues/100)) ([2cb3abe](https://www.github.com/googleapis/nodejs-functions/commit/2cb3abe1b686472610a799235a73f38415ea096f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-functions/CHANGELOG.md | 9 +++++++++ packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 6eb06e11481..95ba113ba85 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +### [1.1.9](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.8...v1.1.9) (2021-08-17) + + +### Bug Fixes + +* **build:** migrate to using main branch ([#103](https://www.github.com/googleapis/nodejs-functions/issues/103)) ([e1955e9](https://www.github.com/googleapis/nodejs-functions/commit/e1955e905b7b4128816bb778450cf60a11ae4b78)) +* **deps:** google-gax v2.24.1 ([#104](https://www.github.com/googleapis/nodejs-functions/issues/104)) ([a419fa4](https://www.github.com/googleapis/nodejs-functions/commit/a419fa46a2056de455989ee8af577fed01ed8fc3)) +* updating behavior of source_upload_url during Get/List function calls ([#100](https://www.github.com/googleapis/nodejs-functions/issues/100)) ([2cb3abe](https://www.github.com/googleapis/nodejs-functions/commit/2cb3abe1b686472610a799235a73f38415ea096f)) + ### [1.1.8](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.7...v1.1.8) (2021-07-21) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 4af782204e5..ea7f4e19b7f 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.8", + "version": "1.1.9", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 3238692524b..9c2348f4b98 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.1.8" + "@google-cloud/functions": "^1.1.9" }, "devDependencies": { "c8": "^7.1.0", From 765305ff010465f1d8bbe0a2d95d4894ec6ecadd Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 13:11:42 -0700 Subject: [PATCH 076/123] docs: minor formatting fixes to Cloud Functions reference docs (#105) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: minor formatting fixes to Cloud Functions reference docs PiperOrigin-RevId: 391298623 Source-Link: https://github.com/googleapis/googleapis/commit/a75aa070342e3aaf1b213a99faf0420920d0162b Source-Link: https://github.com/googleapis/googleapis-gen/commit/632567ba23206749a35cf03e4c636bf1eca9000a * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google/cloud/functions/v1/functions.proto | 14 +++++++------- .../google/cloud/functions/v1/operations.proto | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto index 6523c7db434..98a6d536199 100644 --- a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto @@ -233,7 +233,7 @@ message CloudFunction { // The location of the function source code. oneof source_code { - // The Google Cloud Storage URL, starting with gs://, pointing to the zip + // The Google Cloud Storage URL, starting with `gs://`, pointing to the zip // archive which contains the function. string source_archive_url = 3; @@ -245,9 +245,9 @@ message CloudFunction { // The Google Cloud Storage signed URL used for source uploading, generated // by calling [google.cloud.functions.v1.GenerateUploadUrl]. // - // The signature is validated on write methods {Create, Update} - // The signature is stripped from the Function object on read methods {Get, - // List} + // The signature is validated on write methods (Create, Update) + // The signature is stripped from the Function object on read methods (Get, + // List) string source_upload_url = 16; } @@ -275,7 +275,7 @@ message CloudFunction { // function, optional when updating an existing function. For a complete // list of possible choices, see the // [`gcloud` command - // reference](/sdk/gcloud/reference/functions/deploy#--runtime). + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). string runtime = 19; // The function execution timeout. Execution is considered failed and @@ -310,8 +310,8 @@ message CloudFunction { // project. Otherwise, it must belong to a project within the same // organization. The format of this field is either // `projects/{project}/global/networks/{network}` or `{network}`, where - // {project} is a project id where the network is defined, and {network} is - // the short name of the network. + // `{project}` is a project id where the network is defined, and `{network}` + // is the short name of the network. // // This field is mutually exclusive with `vpc_connector` and will be replaced // by it. diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto index 053ee013256..961cd0b5c86 100644 --- a/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto @@ -43,7 +43,7 @@ enum OperationType { // Metadata describing an [Operation][google.longrunning.Operation] message OperationMetadataV1 { // Target of the operation - for example - // projects/project-1/locations/region-1/functions/function-1 + // `projects/project-1/locations/region-1/functions/function-1` string target = 1; // Type of operation. From 5bd3d8724e1fdea521a57762ec3265d356142ea3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 18:32:22 +0000 Subject: [PATCH 077/123] feat: turns on self-signed JWT feature flag (#106) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 392067151 Source-Link: https://github.com/googleapis/googleapis/commit/06345f7b95c4b4a3ffe4303f1f2984ccc304b2e0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/95882b37970e41e4cd51b22fa507cfd46dc7c4b6 --- .../src/v1/cloud_functions_service_client.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index d0f3895ff57..b59eeb842a1 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -134,6 +134,12 @@ export class CloudFunctionsServiceClient { // 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 = staticMembers.servicePath; + // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; @@ -1788,6 +1794,7 @@ export class CloudFunctionsServiceClient { return this.cloudFunctionsServiceStub!.then(stub => { this._terminated = true; stub.close(); + this.operationsClient.close(); }); } return Promise.resolve(); From d214509882ed91fd4b1768c231cd77413fbdf71c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 16 Sep 2021 07:17:10 -0700 Subject: [PATCH 078/123] feat: add SecurityLevel option on HttpsTrigger (#110) PiperOrigin-RevId: 396889803 Source-Link: https://github.com/googleapis/googleapis/commit/44c497f37f1959360f28ff12d20e3a7c9429378f Source-Link: https://github.com/googleapis/googleapis-gen/commit/79db6277e1ab34845a42ee39d7b4466eef7dd5c0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzlkYjYyNzdlMWFiMzQ4NDVhNDJlZTM5ZDdiNDQ2NmVlZjdkZDVjMCJ9 --- .../google/cloud/functions/v1/functions.proto | 23 ++++++++ .../google-cloud-functions/protos/protos.d.ts | 16 +++++ .../google-cloud-functions/protos/protos.js | 59 ++++++++++++++++++- .../google-cloud-functions/protos/protos.json | 13 ++++ 4 files changed, 110 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto index 98a6d536199..049378ab115 100644 --- a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto @@ -375,8 +375,31 @@ message SourceRepository { // Describes HttpsTrigger, could be used to connect web hooks to function. message HttpsTrigger { + // Available security level settings. + // + // This controls the methods to enforce security (HTTPS) on a URL. + // + // If unspecified, SECURE_OPTIONAL will be used. + enum SecurityLevel { + // Unspecified. + SECURITY_LEVEL_UNSPECIFIED = 0; + + // Requests for a URL that match this handler that do not use HTTPS are + // automatically redirected to the HTTPS URL with the same path. Query + // parameters are reserved for the redirect. + SECURE_ALWAYS = 1; + + // Both HTTP and HTTPS requests with URLs that match the handler succeed + // without redirects. The application can examine the request to determine + // which protocol was used and respond accordingly. + SECURE_OPTIONAL = 2; + } + // Output only. The deployed url for the function. string url = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The security level for the function. + SecurityLevel security_level = 2; } // Describes EventTrigger, used to request events be sent from another diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index eb2d69cfda8..62de62df9c9 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -628,6 +628,9 @@ export namespace google { /** HttpsTrigger url */ url?: (string|null); + + /** HttpsTrigger securityLevel */ + securityLevel?: (google.cloud.functions.v1.HttpsTrigger.SecurityLevel|keyof typeof google.cloud.functions.v1.HttpsTrigger.SecurityLevel|null); } /** Represents a HttpsTrigger. */ @@ -642,6 +645,9 @@ export namespace google { /** HttpsTrigger url. */ public url: string; + /** HttpsTrigger securityLevel. */ + public securityLevel: (google.cloud.functions.v1.HttpsTrigger.SecurityLevel|keyof typeof google.cloud.functions.v1.HttpsTrigger.SecurityLevel); + /** * Creates a new HttpsTrigger instance using the specified properties. * @param [properties] Properties to set @@ -713,6 +719,16 @@ export namespace google { public toJSON(): { [k: string]: any }; } + namespace HttpsTrigger { + + /** SecurityLevel enum. */ + enum SecurityLevel { + SECURITY_LEVEL_UNSPECIFIED = 0, + SECURE_ALWAYS = 1, + SECURE_OPTIONAL = 2 + } + } + /** Properties of an EventTrigger. */ interface IEventTrigger { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index d9466870e3b..e7c6f275185 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -1626,6 +1626,7 @@ * @memberof google.cloud.functions.v1 * @interface IHttpsTrigger * @property {string|null} [url] HttpsTrigger url + * @property {google.cloud.functions.v1.HttpsTrigger.SecurityLevel|null} [securityLevel] HttpsTrigger securityLevel */ /** @@ -1651,6 +1652,14 @@ */ HttpsTrigger.prototype.url = ""; + /** + * HttpsTrigger securityLevel. + * @member {google.cloud.functions.v1.HttpsTrigger.SecurityLevel} securityLevel + * @memberof google.cloud.functions.v1.HttpsTrigger + * @instance + */ + HttpsTrigger.prototype.securityLevel = 0; + /** * Creates a new HttpsTrigger instance using the specified properties. * @function create @@ -1677,6 +1686,8 @@ writer = $Writer.create(); if (message.url != null && Object.hasOwnProperty.call(message, "url")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.securityLevel != null && Object.hasOwnProperty.call(message, "securityLevel")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.securityLevel); return writer; }; @@ -1714,6 +1725,9 @@ case 1: message.url = reader.string(); break; + case 2: + message.securityLevel = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -1752,6 +1766,15 @@ if (message.url != null && message.hasOwnProperty("url")) if (!$util.isString(message.url)) return "url: string expected"; + if (message.securityLevel != null && message.hasOwnProperty("securityLevel")) + switch (message.securityLevel) { + default: + return "securityLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -1769,6 +1792,20 @@ var message = new $root.google.cloud.functions.v1.HttpsTrigger(); if (object.url != null) message.url = String(object.url); + switch (object.securityLevel) { + case "SECURITY_LEVEL_UNSPECIFIED": + case 0: + message.securityLevel = 0; + break; + case "SECURE_ALWAYS": + case 1: + message.securityLevel = 1; + break; + case "SECURE_OPTIONAL": + case 2: + message.securityLevel = 2; + break; + } return message; }; @@ -1785,10 +1822,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.url = ""; + object.securityLevel = options.enums === String ? "SECURITY_LEVEL_UNSPECIFIED" : 0; + } if (message.url != null && message.hasOwnProperty("url")) object.url = message.url; + if (message.securityLevel != null && message.hasOwnProperty("securityLevel")) + object.securityLevel = options.enums === String ? $root.google.cloud.functions.v1.HttpsTrigger.SecurityLevel[message.securityLevel] : message.securityLevel; return object; }; @@ -1803,6 +1844,22 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * SecurityLevel enum. + * @name google.cloud.functions.v1.HttpsTrigger.SecurityLevel + * @enum {number} + * @property {number} SECURITY_LEVEL_UNSPECIFIED=0 SECURITY_LEVEL_UNSPECIFIED value + * @property {number} SECURE_ALWAYS=1 SECURE_ALWAYS value + * @property {number} SECURE_OPTIONAL=2 SECURE_OPTIONAL value + */ + HttpsTrigger.SecurityLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SECURITY_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "SECURE_ALWAYS"] = 1; + values[valuesById[2] = "SECURE_OPTIONAL"] = 2; + return values; + })(); + return HttpsTrigger; })(); diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index a961f4d297e..ae8f3effe20 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -404,6 +404,19 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "securityLevel": { + "type": "SecurityLevel", + "id": 2 + } + }, + "nested": { + "SecurityLevel": { + "values": { + "SECURITY_LEVEL_UNSPECIFIED": 0, + "SECURE_ALWAYS": 1, + "SECURE_OPTIONAL": 2 + } } } }, From f73b1a49767aa8ede7a099543a12b2acc21113b8 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 16 Sep 2021 14:24:27 +0000 Subject: [PATCH 079/123] chore: release 1.2.0 (#107) :robot: I have created a release \*beep\* \*boop\* --- ## [1.2.0](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.9...v1.2.0) (2021-09-16) ### Features * add SecurityLevel option on HttpsTrigger ([#110](https://www.github.com/googleapis/nodejs-functions/issues/110)) ([13d865e](https://www.github.com/googleapis/nodejs-functions/commit/13d865e773a66213c1915ebe2dfc18688e2db300)) * turns on self-signed JWT feature flag ([#106](https://www.github.com/googleapis/nodejs-functions/issues/106)) ([9fb2982](https://www.github.com/googleapis/nodejs-functions/commit/9fb29822945fed6f99a7aefa70bdaf88b7782489)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-functions/CHANGELOG.md | 8 ++++++++ packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 95ba113ba85..f5fb61b6772 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.2.0](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.9...v1.2.0) (2021-09-16) + + +### Features + +* add SecurityLevel option on HttpsTrigger ([#110](https://www.github.com/googleapis/nodejs-functions/issues/110)) ([13d865e](https://www.github.com/googleapis/nodejs-functions/commit/13d865e773a66213c1915ebe2dfc18688e2db300)) +* turns on self-signed JWT feature flag ([#106](https://www.github.com/googleapis/nodejs-functions/issues/106)) ([9fb2982](https://www.github.com/googleapis/nodejs-functions/commit/9fb29822945fed6f99a7aefa70bdaf88b7782489)) + ### [1.1.9](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.8...v1.1.9) (2021-08-17) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index ea7f4e19b7f..d405b1a3a2a 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.1.9", + "version": "1.2.0", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 9c2348f4b98..7156e54a84d 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.1.9" + "@google-cloud/functions": "^1.2.0" }, "devDependencies": { "c8": "^7.1.0", From b46e9fb7ad29e0bb2c8fc4bea34849bdebed5e7f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 00:45:04 +0000 Subject: [PATCH 080/123] build(node): update deps used during postprocessing (#1243) (#118) --- .../google-cloud-functions/protos/protos.d.ts | 3 ++- packages/google-cloud-functions/protos/protos.js | 7 +++++++ .../google-cloud-functions/protos/protos.json | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 62de62df9c9..241497e50e6 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -2648,7 +2648,8 @@ export namespace google { OUTPUT_ONLY = 3, INPUT_ONLY = 4, IMMUTABLE = 5, - UNORDERED_LIST = 6 + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 } /** Properties of a ResourceDescriptor. */ diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index e7c6f275185..40307320c9c 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -6349,6 +6349,7 @@ * @property {number} INPUT_ONLY=4 INPUT_ONLY value * @property {number} IMMUTABLE=5 IMMUTABLE value * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value */ api.FieldBehavior = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -6359,6 +6360,7 @@ values[valuesById[4] = "INPUT_ONLY"] = 4; values[valuesById[5] = "IMMUTABLE"] = 5; values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; return values; })(); @@ -12527,6 +12529,7 @@ case 4: case 5: case 6: + case 7: break; } } @@ -12631,6 +12634,10 @@ case 6: message[".google.api.fieldBehavior"][i] = 6; break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; } } if (object[".google.api.resourceReference"] != null) { diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index ae8f3effe20..015c3b5b2e8 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -805,7 +805,8 @@ "OUTPUT_ONLY": 3, "INPUT_ONLY": 4, "IMMUTABLE": 5, - "UNORDERED_LIST": 6 + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 } }, "resourceReference": { @@ -1448,6 +1449,18 @@ ] ], "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], [ 8, 8 From f98dbfe6d589a5527f70bf8d6ac18c159ed6d45c Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Wed, 27 Oct 2021 13:24:58 -0700 Subject: [PATCH 081/123] chore: fix the wrong post processor image (#120) --- packages/google-cloud-functions/.github/.OwlBot.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/.github/.OwlBot.yaml b/packages/google-cloud-functions/.github/.OwlBot.yaml index 688f4f3d502..1b49af14a32 100644 --- a/packages/google-cloud-functions/.github/.OwlBot.yaml +++ b/packages/google-cloud-functions/.github/.OwlBot.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. docker: - image: gcr.io/repo-automation-bots/owlbot-nodejs:latest + image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest deep-remove-regex: From e39089a6c5ded060b882ea3f81a5176e568ffbf1 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 27 Oct 2021 22:32:16 +0200 Subject: [PATCH 082/123] chore(deps): update dependency @types/node to v16 (#119) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^14.0.24` -> `^16.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/14.17.32/16.11.6) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/compatibility-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/confidence-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index d405b1a3a2a..30705a6db69 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -43,7 +43,7 @@ }, "devDependencies": { "@types/mocha": "^8.0.0", - "@types/node": "^14.0.24", + "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.2.1", "gts": "^2.0.2", From 812c8e0e5da30aee7503d7859cdb428e7a75a90d Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Wed, 3 Nov 2021 11:44:20 -0400 Subject: [PATCH 083/123] chore(cloud-rad): delete api-extractor config (#121) --- .../google-cloud-functions/api-extractor.json | 369 ------------------ 1 file changed, 369 deletions(-) delete mode 100644 packages/google-cloud-functions/api-extractor.json diff --git a/packages/google-cloud-functions/api-extractor.json b/packages/google-cloud-functions/api-extractor.json deleted file mode 100644 index de228294b23..00000000000 --- a/packages/google-cloud-functions/api-extractor.json +++ /dev/null @@ -1,369 +0,0 @@ -/** - * Config file for API Extractor. For more info, please visit: https://api-extractor.com - */ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - - /** - * Optionally specifies another JSON config file that this file extends from. This provides a way for - * standard settings to be shared across multiple projects. - * - * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains - * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be - * resolved using NodeJS require(). - * - * SUPPORTED TOKENS: none - * DEFAULT VALUE: "" - */ - // "extends": "./shared/api-extractor-base.json" - // "extends": "my-package/include/api-extractor-base.json" - - /** - * Determines the "" token that can be used with other config file settings. The project folder - * typically contains the tsconfig.json and package.json config files, but the path is user-defined. - * - * The path is resolved relative to the folder of the config file that contains the setting. - * - * The default value for "projectFolder" is the token "", which means the folder is determined by traversing - * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder - * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error - * will be reported. - * - * SUPPORTED TOKENS: - * DEFAULT VALUE: "" - */ - // "projectFolder": "..", - - /** - * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor - * analyzes the symbols exported by this module. - * - * The file extension must be ".d.ts" and not ".ts". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - */ - "mainEntryPointFilePath": "/protos/protos.d.ts", - - /** - * A list of NPM package names whose exports should be treated as part of this package. - * - * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", - * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part - * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly - * imports library2. To avoid this, we can specify: - * - * "bundledPackages": [ "library2" ], - * - * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been - * local files for library1. - */ - "bundledPackages": [ ], - - /** - * Determines how the TypeScript compiler engine will be invoked by API Extractor. - */ - "compiler": { - /** - * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * Note: This setting will be ignored if "overrideTsconfig" is used. - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/tsconfig.json" - */ - // "tsconfigFilePath": "/tsconfig.json", - - /** - * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. - * The object must conform to the TypeScript tsconfig schema: - * - * http://json.schemastore.org/tsconfig - * - * If omitted, then the tsconfig.json file will be read from the "projectFolder". - * - * DEFAULT VALUE: no overrideTsconfig section - */ - // "overrideTsconfig": { - // . . . - // } - - /** - * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended - * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when - * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses - * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. - * - * DEFAULT VALUE: false - */ - // "skipLibCheck": true, - }, - - /** - * Configures how the API report file (*.api.md) will be generated. - */ - "apiReport": { - /** - * (REQUIRED) Whether to generate an API report. - */ - "enabled": true, - - /** - * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce - * a full file path. - * - * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". - * - * SUPPORTED TOKENS: , - * DEFAULT VALUE: ".api.md" - */ - // "reportFileName": ".api.md", - - /** - * Specifies the folder where the API report file is written. The file name portion is determined by - * the "reportFileName" setting. - * - * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, - * e.g. for an API review. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/etc/" - */ - // "reportFolder": "/etc/", - - /** - * Specifies the folder where the temporary report file is written. The file name portion is determined by - * the "reportFileName" setting. - * - * After the temporary file is written to disk, it is compared with the file in the "reportFolder". - * If they are different, a production build will fail. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/temp/" - */ - // "reportTempFolder": "/temp/" - }, - - /** - * Configures how the doc model file (*.api.json) will be generated. - */ - "docModel": { - /** - * (REQUIRED) Whether to generate a doc model file. - */ - "enabled": true, - - /** - * The output path for the doc model file. The file extension should be ".api.json". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/temp/.api.json" - */ - // "apiJsonFilePath": "/temp/.api.json" - }, - - /** - * Configures how the .d.ts rollup file will be generated. - */ - "dtsRollup": { - /** - * (REQUIRED) Whether to generate the .d.ts rollup file. - */ - "enabled": true, - - /** - * Specifies the output path for a .d.ts rollup file to be generated without any trimming. - * This file will include all declarations that are exported by the main entry point. - * - * If the path is an empty string, then this file will not be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/dist/.d.ts" - */ - // "untrimmedFilePath": "/dist/.d.ts", - - /** - * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. - * This file will include only declarations that are marked as "@public" or "@beta". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "betaTrimmedFilePath": "/dist/-beta.d.ts", - - - /** - * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. - * This file will include only declarations that are marked as "@public". - * - * If the path is an empty string, then this file will not be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "publicTrimmedFilePath": "/dist/-public.d.ts", - - /** - * When a declaration is trimmed, by default it will be replaced by a code comment such as - * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the - * declaration completely. - * - * DEFAULT VALUE: false - */ - // "omitTrimmingComments": true - }, - - /** - * Configures how the tsdoc-metadata.json file will be generated. - */ - "tsdocMetadata": { - /** - * Whether to generate the tsdoc-metadata.json file. - * - * DEFAULT VALUE: true - */ - // "enabled": true, - - /** - * Specifies where the TSDoc metadata file should be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", - * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup - * falls back to "tsdoc-metadata.json" in the package folder. - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" - }, - - /** - * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files - * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. - * To use the OS's default newline kind, specify "os". - * - * DEFAULT VALUE: "crlf" - */ - // "newlineKind": "crlf", - - /** - * Configures how API Extractor reports error and warning messages produced during analysis. - * - * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. - */ - "messages": { - /** - * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing - * the input .d.ts files. - * - * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" - * - * DEFAULT VALUE: A single "default" entry with logLevel=warning. - */ - "compilerMessageReporting": { - /** - * Configures the default routing for messages that don't match an explicit rule in this table. - */ - "default": { - /** - * Specifies whether the message should be written to the the tool's output log. Note that - * the "addToApiReportFile" property may supersede this option. - * - * Possible values: "error", "warning", "none" - * - * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail - * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes - * the "--local" option), the warning is displayed but the build will not fail. - * - * DEFAULT VALUE: "warning" - */ - "logLevel": "warning", - - /** - * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), - * then the message will be written inside that file; otherwise, the message is instead logged according to - * the "logLevel" option. - * - * DEFAULT VALUE: false - */ - // "addToApiReportFile": false - }, - - // "TS2551": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - }, - - /** - * Configures handling of messages reported by API Extractor during its analysis. - * - * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" - * - * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings - */ - "extractorMessageReporting": { - "default": { - "logLevel": "warning", - // "addToApiReportFile": false - }, - - // "ae-extra-release-tag": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - }, - - /** - * Configures handling of messages reported by the TSDoc parser when analyzing code comments. - * - * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" - * - * DEFAULT VALUE: A single "default" entry with logLevel=warning. - */ - "tsdocMessageReporting": { - "default": { - "logLevel": "warning", - // "addToApiReportFile": false - } - - // "tsdoc-link-tag-unescaped-text": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - } - } - -} From 731547e8865ff3da063655dd52fd7bcf161f248c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 4 Nov 2021 20:48:16 +0100 Subject: [PATCH 084/123] chore(deps): update dependency sinon to v12 (#122) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^11.0.0` -> `^12.0.0`](https://renovatebot.com/diffs/npm/sinon/11.1.2/12.0.1) | [![age](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/compatibility-slim/11.1.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/confidence-slim/11.1.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v12.0.1`](https://togithub.com/sinonjs/sinon/blob/master/CHANGES.md#​1201) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v12.0.0...v12.0.1) - [`3f598221`](https://togithub.com/sinonjs/sinon/commit/3f598221045904681f2b3b3ba1df617ed5e230e3) Fix issue with npm unlink for npm version > 6 (Carl-Erik Kopseng) > 'npm unlink' would implicitly unlink the current dir > until version 7, which requires an argument - [`51417a38`](https://togithub.com/sinonjs/sinon/commit/51417a38111eeeb7cd14338bfb762cc2df487e1b) Fix bundling of cjs module ([#​2412](https://togithub.com/sinonjs/sinon/issues/2412)) (Julian Grinblat) > - Fix bundling of cjs module > > - Run prettier *Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2021-11-04.* #### 12.0.0 ### [`v12.0.0`](https://togithub.com/sinonjs/sinon/compare/v11.1.2...v12.0.0) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v11.1.2...v12.0.0)
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 30705a6db69..7110561a5ce 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -54,7 +54,7 @@ "mocha": "^8.0.1", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^11.0.0", + "sinon": "^12.0.0", "ts-loader": "^9.0.0", "typescript": "^3.9.7", "webpack": "^5.0.0", From 1bfe19267f8719d876d1e4bab481d88a3d3e26a7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:33:30 -0800 Subject: [PATCH 085/123] docs(samples): add example tags to generated samples (#124) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(samples): add example tags to generated samples PiperOrigin-RevId: 408439482 Source-Link: https://github.com/googleapis/googleapis/commit/b9f61843dc80c7c285fc34fd3a40aae55082c2b9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/eb888bc214efc7bf43bf4634b470254565a659a5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../linkinator.config.json | 2 +- .../google/cloud/functions/v1/functions.proto | 196 ++- .../cloud/functions/v1/operations.proto | 11 +- .../google-cloud-functions/protos/protos.d.ts | 401 ++++- .../google-cloud-functions/protos/protos.js | 1438 ++++++++++++++--- .../google-cloud-functions/protos/protos.json | 138 +- .../cloud_functions_service.call_function.js | 57 + ...cloud_functions_service.create_function.js | 59 + ...cloud_functions_service.delete_function.js | 53 + ...functions_service.generate_download_url.js | 56 + ...d_functions_service.generate_upload_url.js | 51 + .../cloud_functions_service.get_function.js | 52 + .../cloud_functions_service.get_iam_policy.js | 58 + .../cloud_functions_service.list_functions.js | 68 + .../cloud_functions_service.set_iam_policy.js | 61 + ..._functions_service.test_iam_permissions.js | 61 + ...cloud_functions_service.update_function.js | 57 + .../src/v1/cloud_functions_service_client.ts | 707 ++++---- .../test/gapic_cloud_functions_service_v1.ts | 142 ++ 19 files changed, 3146 insertions(+), 522 deletions(-) create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js create mode 100644 packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js diff --git a/packages/google-cloud-functions/linkinator.config.json b/packages/google-cloud-functions/linkinator.config.json index 29a223b6db6..0121dfa684f 100644 --- a/packages/google-cloud-functions/linkinator.config.json +++ b/packages/google-cloud-functions/linkinator.config.json @@ -6,5 +6,5 @@ "img.shields.io" ], "silent": true, - "concurrency": 10 + "concurrency": 5 } diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto index 049378ab115..29693ddaa3f 100644 --- a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto @@ -32,6 +32,14 @@ option java_multiple_files = true; option java_outer_classname = "FunctionsProto"; option java_package = "com.google.cloud.functions.v1"; option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; // A service that application uses to manipulate triggers and functions. service CloudFunctionsService { @@ -183,6 +191,7 @@ service CloudFunctionsService { // Describes a Cloud Function that contains user computation executed in // response to an event. It encapsulate function and triggers configurations. +// Next tag: 36 message CloudFunction { option (google.api.resource) = { type: "cloudfunctions.googleapis.com/CloudFunction" @@ -304,6 +313,9 @@ message CloudFunction { // Environment variables that shall be available during function execution. map environment_variables = 17; + // Build environment variables that shall be available during build time. + map build_environment_variables = 28; + // The VPC Network that this cloud function can connect to. It can be // either the fully-qualified URI, or the short name of the network resource. // If the short network name is used, the network must belong to the same @@ -322,8 +334,22 @@ message CloudFunction { // The limit on the maximum number of function instances that may coexist at a // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions may, for a + // short period of time, create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you may want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. int32 max_instances = 20; + // A lower bound for the number function instances that may coexist at a + // given time. + int32 min_instances = 32; + // The VPC Network Connector that this cloud function can connect to. It can // be either the fully-qualified URI, or the short name of the network // connector resource. The format of this field is @@ -344,9 +370,86 @@ message CloudFunction { // it. IngressSettings ingress_settings = 24; + // Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function resources. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + // + // If specified, you must also provide an artifact registry repository using + // the `docker_repository` field that was created with the same KMS crypto + // key. + // + // The following service accounts need to be granted Cloud KMS crypto key + // encrypter/decrypter roles on the key. + // + // 1. Google Cloud Functions service account + // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - + // Required to protect the function's image. + // 2. Google Storage service account + // (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - + // Required to protect the function's source code. + // If this service account does not exist, deploying a function without a + // KMS key or retrieving the service agent name provisions it. For more + // information, see + // https://cloud.google.com/storage/docs/projects#service-agents and + // https://cloud.google.com/storage/docs/getting-service-agent#gsutil. + // + // Google Cloud Functions delegates access to service agents to protect + // function resources in internal projects that are not accessible by the + // end user. + string kms_key_name = 25 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // `{project}` and `{region}` are the project id and region respectively where + // the worker pool is defined and `{workerPool}` is the short name of the + // worker pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must + // be granted the role Cloud Build Custom Workers Builder + // (`roles/cloudbuild.customworkers.builder`) in the project. + string build_worker_pool = 26; + // Output only. The Cloud Build ID of the latest successful deployment of the // function. string build_id = 27 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Cloud Build Name of the function deployment. + // `projects//locations//builds/`. + string build_name = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 29; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 30; + + // Input only. An identifier for Firebase function sources. Disclaimer: This field is only + // supported for Firebase function deployments. + string source_token = 31 [(google.api.field_behavior) = INPUT_ONLY]; + + // User managed repository created in Artifact Registry optionally with a + // customer managed encryption key. If specified, deployments will use + // Artifact Registry. If unspecified and the deployment is eligible to use + // Artifact Registry, GCF will create and use a repository named + // 'gcf-artifacts' for every deployed region. This is the repository to which + // the function docker image will be pushed after it is built by Cloud Build. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 34 [(google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + }]; } // Describes SourceRepository, used to represent parameters related to @@ -472,6 +575,73 @@ message FailurePolicy { } } +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from secret manager and expose it as an +// environment variable. Secret value is not a part of the configuration. Secret +// values are only fetched when a new clone starts. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferrably project number but can also be the project + // ID) of the project that contains the secret. If not set, it will be + // populated with the function's project assuming that the secret exists in + // the same project as of the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new clones start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from secret manager and make it available as files mounted +// at the requested paths within the application container. Secret value is not +// a part of the configuration. Every filesystem read operation performs a +// lookup in secret manager to retrieve the secret value. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferrable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version will be fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` would mount the secret value files + // under the `/etc/secrets` directory. This directory will also be completely + // shadowed and unavailable to mount any other secrets. + // + // Recommended mount paths: /etc/secrets + // Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log + string mount_path = 1; + + // Project identifier (preferrably project number but can also be the project + // ID) of the project that contains the secret. If not set, it will be + // populated with the function's project assuming that the secret exists in + // the same project as of the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret will be made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + // Request for the `CreateFunction` method. message CreateFunctionRequest { // Required. The project and location in which the function should be created, specified @@ -490,25 +660,12 @@ message CreateFunctionRequest { // Request for the `UpdateFunction` method. message UpdateFunctionRequest { // Required. New version of the function. - CloudFunction function = 1 [ - (google.api.field_behavior) = REQUIRED - ]; + CloudFunction function = 1 [(google.api.field_behavior) = REQUIRED]; // Required list of fields to be updated in this request. google.protobuf.FieldMask update_mask = 2; } -// Request for the `GetFunction` method. -message GetFunctionRequest { - // Required. The name of the function which details should be obtained. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/CloudFunction" - } - ]; -} - // Describes the current stage of a deployment. enum CloudFunctionStatus { // Not specified. Invalid state. @@ -531,6 +688,17 @@ enum CloudFunctionStatus { UNKNOWN = 5; } +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + } + ]; +} + // Request for the `ListFunctions` method. message ListFunctionsRequest { // The project and location from which the function should be listed, diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto index 961cd0b5c86..183957cca2c 100644 --- a/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// 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. @@ -62,4 +62,13 @@ message OperationMetadataV1 { // The Cloud Build ID of the function created or updated by an API call. // This field is only populated for Create and Update operations. string build_id = 6; + + // An identifier for Firebase function sources. Disclaimer: This field is only + // supported for Firebase function deployments. + string source_token = 7; + + // The Cloud Build Name of the function deployment. + // This field is only populated for Create and Update operations. + // `projects//locations//builds/`. + string build_name = 8; } diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 241497e50e6..8a85a17cbc0 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -335,12 +335,18 @@ export namespace google { /** CloudFunction environmentVariables */ environmentVariables?: ({ [k: string]: string }|null); + /** CloudFunction buildEnvironmentVariables */ + buildEnvironmentVariables?: ({ [k: string]: string }|null); + /** CloudFunction network */ network?: (string|null); /** CloudFunction maxInstances */ maxInstances?: (number|null); + /** CloudFunction minInstances */ + minInstances?: (number|null); + /** CloudFunction vpcConnector */ vpcConnector?: (string|null); @@ -350,8 +356,29 @@ export namespace google { /** CloudFunction ingressSettings */ ingressSettings?: (google.cloud.functions.v1.CloudFunction.IngressSettings|keyof typeof google.cloud.functions.v1.CloudFunction.IngressSettings|null); + /** CloudFunction kmsKeyName */ + kmsKeyName?: (string|null); + + /** CloudFunction buildWorkerPool */ + buildWorkerPool?: (string|null); + /** CloudFunction buildId */ buildId?: (string|null); + + /** CloudFunction buildName */ + buildName?: (string|null); + + /** CloudFunction secretEnvironmentVariables */ + secretEnvironmentVariables?: (google.cloud.functions.v1.ISecretEnvVar[]|null); + + /** CloudFunction secretVolumes */ + secretVolumes?: (google.cloud.functions.v1.ISecretVolume[]|null); + + /** CloudFunction sourceToken */ + sourceToken?: (string|null); + + /** CloudFunction dockerRepository */ + dockerRepository?: (string|null); } /** Represents a CloudFunction. */ @@ -414,12 +441,18 @@ export namespace google { /** CloudFunction environmentVariables. */ public environmentVariables: { [k: string]: string }; + /** CloudFunction buildEnvironmentVariables. */ + public buildEnvironmentVariables: { [k: string]: string }; + /** CloudFunction network. */ public network: string; /** CloudFunction maxInstances. */ public maxInstances: number; + /** CloudFunction minInstances. */ + public minInstances: number; + /** CloudFunction vpcConnector. */ public vpcConnector: string; @@ -429,9 +462,30 @@ export namespace google { /** CloudFunction ingressSettings. */ public ingressSettings: (google.cloud.functions.v1.CloudFunction.IngressSettings|keyof typeof google.cloud.functions.v1.CloudFunction.IngressSettings); + /** CloudFunction kmsKeyName. */ + public kmsKeyName: string; + + /** CloudFunction buildWorkerPool. */ + public buildWorkerPool: string; + /** CloudFunction buildId. */ public buildId: string; + /** CloudFunction buildName. */ + public buildName: string; + + /** CloudFunction secretEnvironmentVariables. */ + public secretEnvironmentVariables: google.cloud.functions.v1.ISecretEnvVar[]; + + /** CloudFunction secretVolumes. */ + public secretVolumes: google.cloud.functions.v1.ISecretVolume[]; + + /** CloudFunction sourceToken. */ + public sourceToken: string; + + /** CloudFunction dockerRepository. */ + public dockerRepository: string; + /** CloudFunction sourceCode. */ public sourceCode?: ("sourceArchiveUrl"|"sourceRepository"|"sourceUploadUrl"); @@ -1017,6 +1071,321 @@ export namespace google { } } + /** Properties of a SecretEnvVar. */ + interface ISecretEnvVar { + + /** SecretEnvVar key */ + key?: (string|null); + + /** SecretEnvVar projectId */ + projectId?: (string|null); + + /** SecretEnvVar secret */ + secret?: (string|null); + + /** SecretEnvVar version */ + version?: (string|null); + } + + /** Represents a SecretEnvVar. */ + class SecretEnvVar implements ISecretEnvVar { + + /** + * Constructs a new SecretEnvVar. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.ISecretEnvVar); + + /** SecretEnvVar key. */ + public key: string; + + /** SecretEnvVar projectId. */ + public projectId: string; + + /** SecretEnvVar secret. */ + public secret: string; + + /** SecretEnvVar version. */ + public version: string; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretEnvVar instance + */ + public static create(properties?: google.cloud.functions.v1.ISecretEnvVar): google.cloud.functions.v1.SecretEnvVar; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v1.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v1.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.SecretEnvVar; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.SecretEnvVar; + + /** + * Verifies a SecretEnvVar message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretEnvVar + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.SecretEnvVar; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @param message SecretEnvVar + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.SecretEnvVar, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretEnvVar to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SecretVolume. */ + interface ISecretVolume { + + /** SecretVolume mountPath */ + mountPath?: (string|null); + + /** SecretVolume projectId */ + projectId?: (string|null); + + /** SecretVolume secret */ + secret?: (string|null); + + /** SecretVolume versions */ + versions?: (google.cloud.functions.v1.SecretVolume.ISecretVersion[]|null); + } + + /** Represents a SecretVolume. */ + class SecretVolume implements ISecretVolume { + + /** + * Constructs a new SecretVolume. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.ISecretVolume); + + /** SecretVolume mountPath. */ + public mountPath: string; + + /** SecretVolume projectId. */ + public projectId: string; + + /** SecretVolume secret. */ + public secret: string; + + /** SecretVolume versions. */ + public versions: google.cloud.functions.v1.SecretVolume.ISecretVersion[]; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVolume instance + */ + public static create(properties?: google.cloud.functions.v1.ISecretVolume): google.cloud.functions.v1.SecretVolume; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.SecretVolume; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.SecretVolume; + + /** + * Verifies a SecretVolume message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVolume + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.SecretVolume; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @param message SecretVolume + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.SecretVolume, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVolume to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SecretVolume { + + /** Properties of a SecretVersion. */ + interface ISecretVersion { + + /** SecretVersion version */ + version?: (string|null); + + /** SecretVersion path */ + path?: (string|null); + } + + /** Represents a SecretVersion. */ + class SecretVersion implements ISecretVersion { + + /** + * Constructs a new SecretVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v1.SecretVolume.ISecretVersion); + + /** SecretVersion version. */ + public version: string; + + /** SecretVersion path. */ + public path: string; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVersion instance + */ + public static create(properties?: google.cloud.functions.v1.SecretVolume.ISecretVersion): google.cloud.functions.v1.SecretVolume.SecretVersion; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v1.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v1.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v1.SecretVolume.SecretVersion; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v1.SecretVolume.SecretVersion; + + /** + * Verifies a SecretVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v1.SecretVolume.SecretVersion; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @param message SecretVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v1.SecretVolume.SecretVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + /** Properties of a CreateFunctionRequest. */ interface ICreateFunctionRequest { @@ -1209,6 +1578,16 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** CloudFunctionStatus enum. */ + enum CloudFunctionStatus { + CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0, + ACTIVE = 1, + OFFLINE = 2, + DEPLOY_IN_PROGRESS = 3, + DELETE_IN_PROGRESS = 4, + UNKNOWN = 5 + } + /** Properties of a GetFunctionRequest. */ interface IGetFunctionRequest { @@ -1299,16 +1678,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** CloudFunctionStatus enum. */ - enum CloudFunctionStatus { - CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0, - ACTIVE = 1, - OFFLINE = 2, - DEPLOY_IN_PROGRESS = 3, - DELETE_IN_PROGRESS = 4, - UNKNOWN = 5 - } - /** Properties of a ListFunctionsRequest. */ interface IListFunctionsRequest { @@ -2195,6 +2564,12 @@ export namespace google { /** OperationMetadataV1 buildId */ buildId?: (string|null); + + /** OperationMetadataV1 sourceToken */ + sourceToken?: (string|null); + + /** OperationMetadataV1 buildName */ + buildName?: (string|null); } /** Represents an OperationMetadataV1. */ @@ -2224,6 +2599,12 @@ export namespace google { /** OperationMetadataV1 buildId. */ public buildId: string; + /** OperationMetadataV1 sourceToken. */ + public sourceToken: string; + + /** OperationMetadataV1 buildName. */ + public buildName: string; + /** * Creates a new OperationMetadataV1 instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 40307320c9c..6f07958e29f 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -487,12 +487,21 @@ * @property {number|Long|null} [versionId] CloudFunction versionId * @property {Object.|null} [labels] CloudFunction labels * @property {Object.|null} [environmentVariables] CloudFunction environmentVariables + * @property {Object.|null} [buildEnvironmentVariables] CloudFunction buildEnvironmentVariables * @property {string|null} [network] CloudFunction network * @property {number|null} [maxInstances] CloudFunction maxInstances + * @property {number|null} [minInstances] CloudFunction minInstances * @property {string|null} [vpcConnector] CloudFunction vpcConnector * @property {google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings|null} [vpcConnectorEgressSettings] CloudFunction vpcConnectorEgressSettings * @property {google.cloud.functions.v1.CloudFunction.IngressSettings|null} [ingressSettings] CloudFunction ingressSettings + * @property {string|null} [kmsKeyName] CloudFunction kmsKeyName + * @property {string|null} [buildWorkerPool] CloudFunction buildWorkerPool * @property {string|null} [buildId] CloudFunction buildId + * @property {string|null} [buildName] CloudFunction buildName + * @property {Array.|null} [secretEnvironmentVariables] CloudFunction secretEnvironmentVariables + * @property {Array.|null} [secretVolumes] CloudFunction secretVolumes + * @property {string|null} [sourceToken] CloudFunction sourceToken + * @property {string|null} [dockerRepository] CloudFunction dockerRepository */ /** @@ -506,6 +515,9 @@ function CloudFunction(properties) { this.labels = {}; this.environmentVariables = {}; + this.buildEnvironmentVariables = {}; + this.secretEnvironmentVariables = []; + this.secretVolumes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -648,6 +660,14 @@ */ CloudFunction.prototype.environmentVariables = $util.emptyObject; + /** + * CloudFunction buildEnvironmentVariables. + * @member {Object.} buildEnvironmentVariables + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.buildEnvironmentVariables = $util.emptyObject; + /** * CloudFunction network. * @member {string} network @@ -664,6 +684,14 @@ */ CloudFunction.prototype.maxInstances = 0; + /** + * CloudFunction minInstances. + * @member {number} minInstances + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.minInstances = 0; + /** * CloudFunction vpcConnector. * @member {string} vpcConnector @@ -688,6 +716,22 @@ */ CloudFunction.prototype.ingressSettings = 0; + /** + * CloudFunction kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.kmsKeyName = ""; + + /** + * CloudFunction buildWorkerPool. + * @member {string} buildWorkerPool + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.buildWorkerPool = ""; + /** * CloudFunction buildId. * @member {string} buildId @@ -696,6 +740,46 @@ */ CloudFunction.prototype.buildId = ""; + /** + * CloudFunction buildName. + * @member {string} buildName + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.buildName = ""; + + /** + * CloudFunction secretEnvironmentVariables. + * @member {Array.} secretEnvironmentVariables + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.secretEnvironmentVariables = $util.emptyArray; + + /** + * CloudFunction secretVolumes. + * @member {Array.} secretVolumes + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.secretVolumes = $util.emptyArray; + + /** + * CloudFunction sourceToken. + * @member {string} sourceToken + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.sourceToken = ""; + + /** + * CloudFunction dockerRepository. + * @member {string} dockerRepository + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.dockerRepository = ""; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -791,8 +875,29 @@ writer.uint32(/* id 23, wireType 0 =*/184).int32(message.vpcConnectorEgressSettings); if (message.ingressSettings != null && Object.hasOwnProperty.call(message, "ingressSettings")) writer.uint32(/* id 24, wireType 0 =*/192).int32(message.ingressSettings); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 25, wireType 2 =*/202).string(message.kmsKeyName); + if (message.buildWorkerPool != null && Object.hasOwnProperty.call(message, "buildWorkerPool")) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.buildWorkerPool); if (message.buildId != null && Object.hasOwnProperty.call(message, "buildId")) writer.uint32(/* id 27, wireType 2 =*/218).string(message.buildId); + if (message.buildEnvironmentVariables != null && Object.hasOwnProperty.call(message, "buildEnvironmentVariables")) + for (var keys = Object.keys(message.buildEnvironmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 28, wireType 2 =*/226).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.buildEnvironmentVariables[keys[i]]).ldelim(); + if (message.secretEnvironmentVariables != null && message.secretEnvironmentVariables.length) + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) + $root.google.cloud.functions.v1.SecretEnvVar.encode(message.secretEnvironmentVariables[i], writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); + if (message.secretVolumes != null && message.secretVolumes.length) + for (var i = 0; i < message.secretVolumes.length; ++i) + $root.google.cloud.functions.v1.SecretVolume.encode(message.secretVolumes[i], writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.sourceToken != null && Object.hasOwnProperty.call(message, "sourceToken")) + writer.uint32(/* id 31, wireType 2 =*/250).string(message.sourceToken); + if (message.minInstances != null && Object.hasOwnProperty.call(message, "minInstances")) + writer.uint32(/* id 32, wireType 0 =*/256).int32(message.minInstances); + if (message.buildName != null && Object.hasOwnProperty.call(message, "buildName")) + writer.uint32(/* id 33, wireType 2 =*/266).string(message.buildName); + if (message.dockerRepository != null && Object.hasOwnProperty.call(message, "dockerRepository")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.dockerRepository); return writer; }; @@ -916,12 +1021,37 @@ } message.environmentVariables[key] = value; break; + case 28: + if (message.buildEnvironmentVariables === $util.emptyObject) + message.buildEnvironmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.buildEnvironmentVariables[key] = value; + break; case 18: message.network = reader.string(); break; case 20: message.maxInstances = reader.int32(); break; + case 32: + message.minInstances = reader.int32(); + break; case 22: message.vpcConnector = reader.string(); break; @@ -931,9 +1061,34 @@ case 24: message.ingressSettings = reader.int32(); break; + case 25: + message.kmsKeyName = reader.string(); + break; + case 26: + message.buildWorkerPool = reader.string(); + break; case 27: message.buildId = reader.string(); break; + case 33: + message.buildName = reader.string(); + break; + case 29: + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v1.SecretEnvVar.decode(reader, reader.uint32())); + break; + case 30: + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v1.SecretVolume.decode(reader, reader.uint32())); + break; + case 31: + message.sourceToken = reader.string(); + break; + case 34: + message.dockerRepository = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -1069,12 +1224,23 @@ if (!$util.isString(message.environmentVariables[key[i]])) return "environmentVariables: string{k:string} expected"; } + if (message.buildEnvironmentVariables != null && message.hasOwnProperty("buildEnvironmentVariables")) { + if (!$util.isObject(message.buildEnvironmentVariables)) + return "buildEnvironmentVariables: object expected"; + var key = Object.keys(message.buildEnvironmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.buildEnvironmentVariables[key[i]])) + return "buildEnvironmentVariables: string{k:string} expected"; + } if (message.network != null && message.hasOwnProperty("network")) if (!$util.isString(message.network)) return "network: string expected"; if (message.maxInstances != null && message.hasOwnProperty("maxInstances")) if (!$util.isInteger(message.maxInstances)) return "maxInstances: integer expected"; + if (message.minInstances != null && message.hasOwnProperty("minInstances")) + if (!$util.isInteger(message.minInstances)) + return "minInstances: integer expected"; if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) if (!$util.isString(message.vpcConnector)) return "vpcConnector: string expected"; @@ -1097,9 +1263,42 @@ case 3: break; } + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.buildWorkerPool != null && message.hasOwnProperty("buildWorkerPool")) + if (!$util.isString(message.buildWorkerPool)) + return "buildWorkerPool: string expected"; if (message.buildId != null && message.hasOwnProperty("buildId")) if (!$util.isString(message.buildId)) return "buildId: string expected"; + if (message.buildName != null && message.hasOwnProperty("buildName")) + if (!$util.isString(message.buildName)) + return "buildName: string expected"; + if (message.secretEnvironmentVariables != null && message.hasOwnProperty("secretEnvironmentVariables")) { + if (!Array.isArray(message.secretEnvironmentVariables)) + return "secretEnvironmentVariables: array expected"; + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) { + var error = $root.google.cloud.functions.v1.SecretEnvVar.verify(message.secretEnvironmentVariables[i]); + if (error) + return "secretEnvironmentVariables." + error; + } + } + if (message.secretVolumes != null && message.hasOwnProperty("secretVolumes")) { + if (!Array.isArray(message.secretVolumes)) + return "secretVolumes: array expected"; + for (var i = 0; i < message.secretVolumes.length; ++i) { + var error = $root.google.cloud.functions.v1.SecretVolume.verify(message.secretVolumes[i]); + if (error) + return "secretVolumes." + error; + } + } + if (message.sourceToken != null && message.hasOwnProperty("sourceToken")) + if (!$util.isString(message.sourceToken)) + return "sourceToken: string expected"; + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + if (!$util.isString(message.dockerRepository)) + return "dockerRepository: string expected"; return null; }; @@ -1205,10 +1404,19 @@ for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); } + if (object.buildEnvironmentVariables) { + if (typeof object.buildEnvironmentVariables !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.buildEnvironmentVariables: object expected"); + message.buildEnvironmentVariables = {}; + for (var keys = Object.keys(object.buildEnvironmentVariables), i = 0; i < keys.length; ++i) + message.buildEnvironmentVariables[keys[i]] = String(object.buildEnvironmentVariables[keys[i]]); + } if (object.network != null) message.network = String(object.network); if (object.maxInstances != null) message.maxInstances = object.maxInstances | 0; + if (object.minInstances != null) + message.minInstances = object.minInstances | 0; if (object.vpcConnector != null) message.vpcConnector = String(object.vpcConnector); switch (object.vpcConnectorEgressSettings) { @@ -1243,8 +1451,38 @@ message.ingressSettings = 3; break; } + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.buildWorkerPool != null) + message.buildWorkerPool = String(object.buildWorkerPool); if (object.buildId != null) message.buildId = String(object.buildId); + if (object.buildName != null) + message.buildName = String(object.buildName); + if (object.secretEnvironmentVariables) { + if (!Array.isArray(object.secretEnvironmentVariables)) + throw TypeError(".google.cloud.functions.v1.CloudFunction.secretEnvironmentVariables: array expected"); + message.secretEnvironmentVariables = []; + for (var i = 0; i < object.secretEnvironmentVariables.length; ++i) { + if (typeof object.secretEnvironmentVariables[i] !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.secretEnvironmentVariables: object expected"); + message.secretEnvironmentVariables[i] = $root.google.cloud.functions.v1.SecretEnvVar.fromObject(object.secretEnvironmentVariables[i]); + } + } + if (object.secretVolumes) { + if (!Array.isArray(object.secretVolumes)) + throw TypeError(".google.cloud.functions.v1.CloudFunction.secretVolumes: array expected"); + message.secretVolumes = []; + for (var i = 0; i < object.secretVolumes.length; ++i) { + if (typeof object.secretVolumes[i] !== "object") + throw TypeError(".google.cloud.functions.v1.CloudFunction.secretVolumes: object expected"); + message.secretVolumes[i] = $root.google.cloud.functions.v1.SecretVolume.fromObject(object.secretVolumes[i]); + } + } + if (object.sourceToken != null) + message.sourceToken = String(object.sourceToken); + if (object.dockerRepository != null) + message.dockerRepository = String(object.dockerRepository); return message; }; @@ -1261,9 +1499,14 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.secretEnvironmentVariables = []; + object.secretVolumes = []; + } if (options.objects || options.defaults) { object.labels = {}; object.environmentVariables = {}; + object.buildEnvironmentVariables = {}; } if (options.defaults) { object.name = ""; @@ -1285,7 +1528,13 @@ object.vpcConnector = ""; object.vpcConnectorEgressSettings = options.enums === String ? "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" : 0; object.ingressSettings = options.enums === String ? "INGRESS_SETTINGS_UNSPECIFIED" : 0; + object.kmsKeyName = ""; + object.buildWorkerPool = ""; object.buildId = ""; + object.sourceToken = ""; + object.minInstances = 0; + object.buildName = ""; + object.dockerRepository = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -1356,8 +1605,35 @@ object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.IngressSettings[message.ingressSettings] : message.ingressSettings; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.buildWorkerPool != null && message.hasOwnProperty("buildWorkerPool")) + object.buildWorkerPool = message.buildWorkerPool; if (message.buildId != null && message.hasOwnProperty("buildId")) object.buildId = message.buildId; + if (message.buildEnvironmentVariables && (keys2 = Object.keys(message.buildEnvironmentVariables)).length) { + object.buildEnvironmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.buildEnvironmentVariables[keys2[j]] = message.buildEnvironmentVariables[keys2[j]]; + } + if (message.secretEnvironmentVariables && message.secretEnvironmentVariables.length) { + object.secretEnvironmentVariables = []; + for (var j = 0; j < message.secretEnvironmentVariables.length; ++j) + object.secretEnvironmentVariables[j] = $root.google.cloud.functions.v1.SecretEnvVar.toObject(message.secretEnvironmentVariables[j], options); + } + if (message.secretVolumes && message.secretVolumes.length) { + object.secretVolumes = []; + for (var j = 0; j < message.secretVolumes.length; ++j) + object.secretVolumes[j] = $root.google.cloud.functions.v1.SecretVolume.toObject(message.secretVolumes[j], options); + } + if (message.sourceToken != null && message.hasOwnProperty("sourceToken")) + object.sourceToken = message.sourceToken; + if (message.minInstances != null && message.hasOwnProperty("minInstances")) + object.minInstances = message.minInstances; + if (message.buildName != null && message.hasOwnProperty("buildName")) + object.buildName = message.buildName; + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + object.dockerRepository = message.dockerRepository; return object; }; @@ -2053,93 +2329,722 @@ }; /** - * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.EventTrigger} EventTrigger + */ + EventTrigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.EventTrigger) + return object; + var message = new $root.google.cloud.functions.v1.EventTrigger(); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.resource != null) + message.resource = String(object.resource); + if (object.service != null) + message.service = String(object.service); + if (object.failurePolicy != null) { + if (typeof object.failurePolicy !== "object") + throw TypeError(".google.cloud.functions.v1.EventTrigger.failurePolicy: object expected"); + message.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.fromObject(object.failurePolicy); + } + return message; + }; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {google.cloud.functions.v1.EventTrigger} message EventTrigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventTrigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.eventType = ""; + object.resource = ""; + object.service = ""; + object.failurePolicy = null; + } + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.failurePolicy != null && message.hasOwnProperty("failurePolicy")) + object.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.toObject(message.failurePolicy, options); + return object; + }; + + /** + * Converts this EventTrigger to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.EventTrigger + * @instance + * @returns {Object.} JSON object + */ + EventTrigger.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventTrigger; + })(); + + v1.FailurePolicy = (function() { + + /** + * Properties of a FailurePolicy. + * @memberof google.cloud.functions.v1 + * @interface IFailurePolicy + * @property {google.cloud.functions.v1.FailurePolicy.IRetry|null} [retry] FailurePolicy retry + */ + + /** + * Constructs a new FailurePolicy. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a FailurePolicy. + * @implements IFailurePolicy + * @constructor + * @param {google.cloud.functions.v1.IFailurePolicy=} [properties] Properties to set + */ + function FailurePolicy(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FailurePolicy retry. + * @member {google.cloud.functions.v1.FailurePolicy.IRetry|null|undefined} retry + * @memberof google.cloud.functions.v1.FailurePolicy + * @instance + */ + FailurePolicy.prototype.retry = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FailurePolicy action. + * @member {"retry"|undefined} action + * @memberof google.cloud.functions.v1.FailurePolicy + * @instance + */ + Object.defineProperty(FailurePolicy.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["retry"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FailurePolicy instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {google.cloud.functions.v1.IFailurePolicy=} [properties] Properties to set + * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy instance + */ + FailurePolicy.create = function create(properties) { + return new FailurePolicy(properties); + }; + + /** + * Encodes the specified FailurePolicy message. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {google.cloud.functions.v1.IFailurePolicy} message FailurePolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailurePolicy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.retry != null && Object.hasOwnProperty.call(message, "retry")) + $root.google.cloud.functions.v1.FailurePolicy.Retry.encode(message.retry, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FailurePolicy message, length delimited. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {google.cloud.functions.v1.IFailurePolicy} message FailurePolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailurePolicy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FailurePolicy message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailurePolicy.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.FailurePolicy(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FailurePolicy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailurePolicy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FailurePolicy message. + * @function verify + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FailurePolicy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.retry != null && message.hasOwnProperty("retry")) { + properties.action = 1; + { + var error = $root.google.cloud.functions.v1.FailurePolicy.Retry.verify(message.retry); + if (error) + return "retry." + error; + } + } + return null; + }; + + /** + * Creates a FailurePolicy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + */ + FailurePolicy.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.FailurePolicy) + return object; + var message = new $root.google.cloud.functions.v1.FailurePolicy(); + if (object.retry != null) { + if (typeof object.retry !== "object") + throw TypeError(".google.cloud.functions.v1.FailurePolicy.retry: object expected"); + message.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.fromObject(object.retry); + } + return message; + }; + + /** + * Creates a plain object from a FailurePolicy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {google.cloud.functions.v1.FailurePolicy} message FailurePolicy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FailurePolicy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.retry != null && message.hasOwnProperty("retry")) { + object.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.toObject(message.retry, options); + if (options.oneofs) + object.action = "retry"; + } + return object; + }; + + /** + * Converts this FailurePolicy to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.FailurePolicy + * @instance + * @returns {Object.} JSON object + */ + FailurePolicy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + FailurePolicy.Retry = (function() { + + /** + * Properties of a Retry. + * @memberof google.cloud.functions.v1.FailurePolicy + * @interface IRetry + */ + + /** + * Constructs a new Retry. + * @memberof google.cloud.functions.v1.FailurePolicy + * @classdesc Represents a Retry. + * @implements IRetry + * @constructor + * @param {google.cloud.functions.v1.FailurePolicy.IRetry=} [properties] Properties to set + */ + function Retry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Retry instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {google.cloud.functions.v1.FailurePolicy.IRetry=} [properties] Properties to set + * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry instance + */ + Retry.create = function create(properties) { + return new Retry(properties); + }; + + /** + * Encodes the specified Retry message. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.Retry.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {google.cloud.functions.v1.FailurePolicy.IRetry} message Retry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Retry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Retry message, length delimited. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.Retry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {google.cloud.functions.v1.FailurePolicy.IRetry} message Retry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Retry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Retry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Retry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.FailurePolicy.Retry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Retry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Retry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Retry message. + * @function verify + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Retry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a Retry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + */ + Retry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.FailurePolicy.Retry) + return object; + return new $root.google.cloud.functions.v1.FailurePolicy.Retry(); + }; + + /** + * Creates a plain object from a Retry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {google.cloud.functions.v1.FailurePolicy.Retry} message Retry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Retry.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Retry to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @instance + * @returns {Object.} JSON object + */ + Retry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Retry; + })(); + + return FailurePolicy; + })(); + + v1.SecretEnvVar = (function() { + + /** + * Properties of a SecretEnvVar. + * @memberof google.cloud.functions.v1 + * @interface ISecretEnvVar + * @property {string|null} [key] SecretEnvVar key + * @property {string|null} [projectId] SecretEnvVar projectId + * @property {string|null} [secret] SecretEnvVar secret + * @property {string|null} [version] SecretEnvVar version + */ + + /** + * Constructs a new SecretEnvVar. + * @memberof google.cloud.functions.v1 + * @classdesc Represents a SecretEnvVar. + * @implements ISecretEnvVar + * @constructor + * @param {google.cloud.functions.v1.ISecretEnvVar=} [properties] Properties to set + */ + function SecretEnvVar(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretEnvVar key. + * @member {string} key + * @memberof google.cloud.functions.v1.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.key = ""; + + /** + * SecretEnvVar projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v1.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.projectId = ""; + + /** + * SecretEnvVar secret. + * @member {string} secret + * @memberof google.cloud.functions.v1.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.secret = ""; + + /** + * SecretEnvVar version. + * @member {string} version + * @memberof google.cloud.functions.v1.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.version = ""; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v1.SecretEnvVar + * @static + * @param {google.cloud.functions.v1.ISecretEnvVar=} [properties] Properties to set + * @returns {google.cloud.functions.v1.SecretEnvVar} SecretEnvVar instance + */ + SecretEnvVar.create = function create(properties) { + return new SecretEnvVar(properties); + }; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v1.SecretEnvVar.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.SecretEnvVar + * @static + * @param {google.cloud.functions.v1.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.version); + return writer; + }; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v1.SecretEnvVar.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.SecretEnvVar + * @static + * @param {google.cloud.functions.v1.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v1.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v1.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.SecretEnvVar(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v1.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretEnvVar message. + * @function verify + * @memberof google.cloud.functions.v1.SecretEnvVar + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretEnvVar.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.functions.v1.EventTrigger + * @memberof google.cloud.functions.v1.SecretEnvVar * @static * @param {Object.} object Plain object - * @returns {google.cloud.functions.v1.EventTrigger} EventTrigger + * @returns {google.cloud.functions.v1.SecretEnvVar} SecretEnvVar */ - EventTrigger.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.functions.v1.EventTrigger) + SecretEnvVar.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.SecretEnvVar) return object; - var message = new $root.google.cloud.functions.v1.EventTrigger(); - if (object.eventType != null) - message.eventType = String(object.eventType); - if (object.resource != null) - message.resource = String(object.resource); - if (object.service != null) - message.service = String(object.service); - if (object.failurePolicy != null) { - if (typeof object.failurePolicy !== "object") - throw TypeError(".google.cloud.functions.v1.EventTrigger.failurePolicy: object expected"); - message.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.fromObject(object.failurePolicy); - } + var message = new $root.google.cloud.functions.v1.SecretEnvVar(); + if (object.key != null) + message.key = String(object.key); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.version != null) + message.version = String(object.version); return message; }; /** - * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.functions.v1.EventTrigger + * @memberof google.cloud.functions.v1.SecretEnvVar * @static - * @param {google.cloud.functions.v1.EventTrigger} message EventTrigger + * @param {google.cloud.functions.v1.SecretEnvVar} message SecretEnvVar * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EventTrigger.toObject = function toObject(message, options) { + SecretEnvVar.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.eventType = ""; - object.resource = ""; - object.service = ""; - object.failurePolicy = null; + object.key = ""; + object.projectId = ""; + object.secret = ""; + object.version = ""; } - if (message.eventType != null && message.hasOwnProperty("eventType")) - object.eventType = message.eventType; - if (message.resource != null && message.hasOwnProperty("resource")) - object.resource = message.resource; - if (message.service != null && message.hasOwnProperty("service")) - object.service = message.service; - if (message.failurePolicy != null && message.hasOwnProperty("failurePolicy")) - object.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.toObject(message.failurePolicy, options); + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; return object; }; /** - * Converts this EventTrigger to JSON. + * Converts this SecretEnvVar to JSON. * @function toJSON - * @memberof google.cloud.functions.v1.EventTrigger + * @memberof google.cloud.functions.v1.SecretEnvVar * @instance * @returns {Object.} JSON object */ - EventTrigger.prototype.toJSON = function toJSON() { + SecretEnvVar.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EventTrigger; + return SecretEnvVar; })(); - v1.FailurePolicy = (function() { + v1.SecretVolume = (function() { /** - * Properties of a FailurePolicy. + * Properties of a SecretVolume. * @memberof google.cloud.functions.v1 - * @interface IFailurePolicy - * @property {google.cloud.functions.v1.FailurePolicy.IRetry|null} [retry] FailurePolicy retry + * @interface ISecretVolume + * @property {string|null} [mountPath] SecretVolume mountPath + * @property {string|null} [projectId] SecretVolume projectId + * @property {string|null} [secret] SecretVolume secret + * @property {Array.|null} [versions] SecretVolume versions */ /** - * Constructs a new FailurePolicy. + * Constructs a new SecretVolume. * @memberof google.cloud.functions.v1 - * @classdesc Represents a FailurePolicy. - * @implements IFailurePolicy + * @classdesc Represents a SecretVolume. + * @implements ISecretVolume * @constructor - * @param {google.cloud.functions.v1.IFailurePolicy=} [properties] Properties to set + * @param {google.cloud.functions.v1.ISecretVolume=} [properties] Properties to set */ - function FailurePolicy(properties) { + function SecretVolume(properties) { + this.versions = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2147,89 +3052,117 @@ } /** - * FailurePolicy retry. - * @member {google.cloud.functions.v1.FailurePolicy.IRetry|null|undefined} retry - * @memberof google.cloud.functions.v1.FailurePolicy + * SecretVolume mountPath. + * @member {string} mountPath + * @memberof google.cloud.functions.v1.SecretVolume * @instance */ - FailurePolicy.prototype.retry = null; + SecretVolume.prototype.mountPath = ""; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * SecretVolume projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v1.SecretVolume + * @instance + */ + SecretVolume.prototype.projectId = ""; /** - * FailurePolicy action. - * @member {"retry"|undefined} action - * @memberof google.cloud.functions.v1.FailurePolicy + * SecretVolume secret. + * @member {string} secret + * @memberof google.cloud.functions.v1.SecretVolume * @instance */ - Object.defineProperty(FailurePolicy.prototype, "action", { - get: $util.oneOfGetter($oneOfFields = ["retry"]), - set: $util.oneOfSetter($oneOfFields) - }); + SecretVolume.prototype.secret = ""; /** - * Creates a new FailurePolicy instance using the specified properties. + * SecretVolume versions. + * @member {Array.} versions + * @memberof google.cloud.functions.v1.SecretVolume + * @instance + */ + SecretVolume.prototype.versions = $util.emptyArray; + + /** + * Creates a new SecretVolume instance using the specified properties. * @function create - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @static - * @param {google.cloud.functions.v1.IFailurePolicy=} [properties] Properties to set - * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy instance + * @param {google.cloud.functions.v1.ISecretVolume=} [properties] Properties to set + * @returns {google.cloud.functions.v1.SecretVolume} SecretVolume instance */ - FailurePolicy.create = function create(properties) { - return new FailurePolicy(properties); + SecretVolume.create = function create(properties) { + return new SecretVolume(properties); }; /** - * Encodes the specified FailurePolicy message. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.verify|verify} messages. + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.verify|verify} messages. * @function encode - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @static - * @param {google.cloud.functions.v1.IFailurePolicy} message FailurePolicy message or plain object to encode + * @param {google.cloud.functions.v1.ISecretVolume} message SecretVolume message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FailurePolicy.encode = function encode(message, writer) { + SecretVolume.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.retry != null && Object.hasOwnProperty.call(message, "retry")) - $root.google.cloud.functions.v1.FailurePolicy.Retry.encode(message.retry, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mountPath != null && Object.hasOwnProperty.call(message, "mountPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mountPath); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.google.cloud.functions.v1.SecretVolume.SecretVersion.encode(message.versions[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified FailurePolicy message, length delimited. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.verify|verify} messages. + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @static - * @param {google.cloud.functions.v1.IFailurePolicy} message FailurePolicy message or plain object to encode + * @param {google.cloud.functions.v1.ISecretVolume} message SecretVolume message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FailurePolicy.encodeDelimited = function encodeDelimited(message, writer) { + SecretVolume.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FailurePolicy message from the specified reader or buffer. + * Decodes a SecretVolume message from the specified reader or buffer. * @function decode - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + * @returns {google.cloud.functions.v1.SecretVolume} SecretVolume * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FailurePolicy.decode = function decode(reader, length) { + SecretVolume.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.FailurePolicy(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.SecretVolume(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.decode(reader, reader.uint32()); + message.mountPath = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v1.SecretVolume.SecretVersion.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -2240,113 +3173,148 @@ }; /** - * Decodes a FailurePolicy message from the specified reader or buffer, length delimited. + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + * @returns {google.cloud.functions.v1.SecretVolume} SecretVolume * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FailurePolicy.decodeDelimited = function decodeDelimited(reader) { + SecretVolume.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FailurePolicy message. + * Verifies a SecretVolume message. * @function verify - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FailurePolicy.verify = function verify(message) { + SecretVolume.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.retry != null && message.hasOwnProperty("retry")) { - properties.action = 1; - { - var error = $root.google.cloud.functions.v1.FailurePolicy.Retry.verify(message.retry); + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + if (!$util.isString(message.mountPath)) + return "mountPath: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.google.cloud.functions.v1.SecretVolume.SecretVersion.verify(message.versions[i]); if (error) - return "retry." + error; + return "versions." + error; } } return null; }; /** - * Creates a FailurePolicy message from a plain object. Also converts values to their respective internal types. + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @static * @param {Object.} object Plain object - * @returns {google.cloud.functions.v1.FailurePolicy} FailurePolicy + * @returns {google.cloud.functions.v1.SecretVolume} SecretVolume */ - FailurePolicy.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.functions.v1.FailurePolicy) + SecretVolume.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.SecretVolume) return object; - var message = new $root.google.cloud.functions.v1.FailurePolicy(); - if (object.retry != null) { - if (typeof object.retry !== "object") - throw TypeError(".google.cloud.functions.v1.FailurePolicy.retry: object expected"); - message.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.fromObject(object.retry); + var message = new $root.google.cloud.functions.v1.SecretVolume(); + if (object.mountPath != null) + message.mountPath = String(object.mountPath); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".google.cloud.functions.v1.SecretVolume.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".google.cloud.functions.v1.SecretVolume.versions: object expected"); + message.versions[i] = $root.google.cloud.functions.v1.SecretVolume.SecretVersion.fromObject(object.versions[i]); + } } return message; }; /** - * Creates a plain object from a FailurePolicy message. Also converts values to other types if specified. + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @static - * @param {google.cloud.functions.v1.FailurePolicy} message FailurePolicy + * @param {google.cloud.functions.v1.SecretVolume} message SecretVolume * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FailurePolicy.toObject = function toObject(message, options) { + SecretVolume.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (message.retry != null && message.hasOwnProperty("retry")) { - object.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.toObject(message.retry, options); - if (options.oneofs) - object.action = "retry"; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) { + object.mountPath = ""; + object.projectId = ""; + object.secret = ""; + } + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + object.mountPath = message.mountPath; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.google.cloud.functions.v1.SecretVolume.SecretVersion.toObject(message.versions[j], options); } return object; }; /** - * Converts this FailurePolicy to JSON. + * Converts this SecretVolume to JSON. * @function toJSON - * @memberof google.cloud.functions.v1.FailurePolicy + * @memberof google.cloud.functions.v1.SecretVolume * @instance * @returns {Object.} JSON object */ - FailurePolicy.prototype.toJSON = function toJSON() { + SecretVolume.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - FailurePolicy.Retry = (function() { + SecretVolume.SecretVersion = (function() { /** - * Properties of a Retry. - * @memberof google.cloud.functions.v1.FailurePolicy - * @interface IRetry + * Properties of a SecretVersion. + * @memberof google.cloud.functions.v1.SecretVolume + * @interface ISecretVersion + * @property {string|null} [version] SecretVersion version + * @property {string|null} [path] SecretVersion path */ /** - * Constructs a new Retry. - * @memberof google.cloud.functions.v1.FailurePolicy - * @classdesc Represents a Retry. - * @implements IRetry + * Constructs a new SecretVersion. + * @memberof google.cloud.functions.v1.SecretVolume + * @classdesc Represents a SecretVersion. + * @implements ISecretVersion * @constructor - * @param {google.cloud.functions.v1.FailurePolicy.IRetry=} [properties] Properties to set + * @param {google.cloud.functions.v1.SecretVolume.ISecretVersion=} [properties] Properties to set */ - function Retry(properties) { + function SecretVersion(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2354,63 +3322,89 @@ } /** - * Creates a new Retry instance using the specified properties. + * SecretVersion version. + * @member {string} version + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.version = ""; + + /** + * SecretVersion path. + * @member {string} path + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.path = ""; + + /** + * Creates a new SecretVersion instance using the specified properties. * @function create - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @static - * @param {google.cloud.functions.v1.FailurePolicy.IRetry=} [properties] Properties to set - * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry instance + * @param {google.cloud.functions.v1.SecretVolume.ISecretVersion=} [properties] Properties to set + * @returns {google.cloud.functions.v1.SecretVolume.SecretVersion} SecretVersion instance */ - Retry.create = function create(properties) { - return new Retry(properties); + SecretVersion.create = function create(properties) { + return new SecretVersion(properties); }; /** - * Encodes the specified Retry message. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.Retry.verify|verify} messages. + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.SecretVersion.verify|verify} messages. * @function encode - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @static - * @param {google.cloud.functions.v1.FailurePolicy.IRetry} message Retry message or plain object to encode + * @param {google.cloud.functions.v1.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Retry.encode = function encode(message, writer) { + SecretVersion.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); return writer; }; /** - * Encodes the specified Retry message, length delimited. Does not implicitly {@link google.cloud.functions.v1.FailurePolicy.Retry.verify|verify} messages. + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.SecretVersion.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @static - * @param {google.cloud.functions.v1.FailurePolicy.IRetry} message Retry message or plain object to encode + * @param {google.cloud.functions.v1.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Retry.encodeDelimited = function encodeDelimited(message, writer) { + SecretVersion.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Retry message from the specified reader or buffer. + * Decodes a SecretVersion message from the specified reader or buffer. * @function decode - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + * @returns {google.cloud.functions.v1.SecretVolume.SecretVersion} SecretVersion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Retry.decode = function decode(reader, length) { + SecretVersion.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.FailurePolicy.Retry(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v1.SecretVolume.SecretVersion(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.path = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -2420,77 +3414,99 @@ }; /** - * Decodes a Retry message from the specified reader or buffer, length delimited. + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + * @returns {google.cloud.functions.v1.SecretVolume.SecretVersion} SecretVersion * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Retry.decodeDelimited = function decodeDelimited(reader) { + SecretVersion.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Retry message. + * Verifies a SecretVersion message. * @function verify - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Retry.verify = function verify(message) { + SecretVersion.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; return null; }; /** - * Creates a Retry message from a plain object. Also converts values to their respective internal types. + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @static * @param {Object.} object Plain object - * @returns {google.cloud.functions.v1.FailurePolicy.Retry} Retry + * @returns {google.cloud.functions.v1.SecretVolume.SecretVersion} SecretVersion */ - Retry.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.functions.v1.FailurePolicy.Retry) + SecretVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.SecretVolume.SecretVersion) return object; - return new $root.google.cloud.functions.v1.FailurePolicy.Retry(); + var message = new $root.google.cloud.functions.v1.SecretVolume.SecretVersion(); + if (object.version != null) + message.version = String(object.version); + if (object.path != null) + message.path = String(object.path); + return message; }; /** - * Creates a plain object from a Retry message. Also converts values to other types if specified. + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @static - * @param {google.cloud.functions.v1.FailurePolicy.Retry} message Retry + * @param {google.cloud.functions.v1.SecretVolume.SecretVersion} message SecretVersion * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Retry.toObject = function toObject() { - return {}; + SecretVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = ""; + object.path = ""; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; }; /** - * Converts this Retry to JSON. + * Converts this SecretVersion to JSON. * @function toJSON - * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion * @instance * @returns {Object.} JSON object */ - Retry.prototype.toJSON = function toJSON() { + SecretVersion.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Retry; + return SecretVersion; })(); - return FailurePolicy; + return SecretVolume; })(); v1.CreateFunctionRequest = (function() { @@ -2928,6 +3944,28 @@ return UpdateFunctionRequest; })(); + /** + * CloudFunctionStatus enum. + * @name google.cloud.functions.v1.CloudFunctionStatus + * @enum {number} + * @property {number} CLOUD_FUNCTION_STATUS_UNSPECIFIED=0 CLOUD_FUNCTION_STATUS_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} OFFLINE=2 OFFLINE value + * @property {number} DEPLOY_IN_PROGRESS=3 DEPLOY_IN_PROGRESS value + * @property {number} DELETE_IN_PROGRESS=4 DELETE_IN_PROGRESS value + * @property {number} UNKNOWN=5 UNKNOWN value + */ + v1.CloudFunctionStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLOUD_FUNCTION_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "OFFLINE"] = 2; + values[valuesById[3] = "DEPLOY_IN_PROGRESS"] = 3; + values[valuesById[4] = "DELETE_IN_PROGRESS"] = 4; + values[valuesById[5] = "UNKNOWN"] = 5; + return values; + })(); + v1.GetFunctionRequest = (function() { /** @@ -3115,28 +4153,6 @@ return GetFunctionRequest; })(); - /** - * CloudFunctionStatus enum. - * @name google.cloud.functions.v1.CloudFunctionStatus - * @enum {number} - * @property {number} CLOUD_FUNCTION_STATUS_UNSPECIFIED=0 CLOUD_FUNCTION_STATUS_UNSPECIFIED value - * @property {number} ACTIVE=1 ACTIVE value - * @property {number} OFFLINE=2 OFFLINE value - * @property {number} DEPLOY_IN_PROGRESS=3 DEPLOY_IN_PROGRESS value - * @property {number} DELETE_IN_PROGRESS=4 DELETE_IN_PROGRESS value - * @property {number} UNKNOWN=5 UNKNOWN value - */ - v1.CloudFunctionStatus = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CLOUD_FUNCTION_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "ACTIVE"] = 1; - values[valuesById[2] = "OFFLINE"] = 2; - values[valuesById[3] = "DEPLOY_IN_PROGRESS"] = 3; - values[valuesById[4] = "DELETE_IN_PROGRESS"] = 4; - values[valuesById[5] = "UNKNOWN"] = 5; - return values; - })(); - v1.ListFunctionsRequest = (function() { /** @@ -5083,6 +6099,8 @@ * @property {number|Long|null} [versionId] OperationMetadataV1 versionId * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadataV1 updateTime * @property {string|null} [buildId] OperationMetadataV1 buildId + * @property {string|null} [sourceToken] OperationMetadataV1 sourceToken + * @property {string|null} [buildName] OperationMetadataV1 buildName */ /** @@ -5148,6 +6166,22 @@ */ OperationMetadataV1.prototype.buildId = ""; + /** + * OperationMetadataV1 sourceToken. + * @member {string} sourceToken + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + */ + OperationMetadataV1.prototype.sourceToken = ""; + + /** + * OperationMetadataV1 buildName. + * @member {string} buildName + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @instance + */ + OperationMetadataV1.prototype.buildName = ""; + /** * Creates a new OperationMetadataV1 instance using the specified properties. * @function create @@ -5184,6 +6218,10 @@ $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.buildId != null && Object.hasOwnProperty.call(message, "buildId")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.buildId); + if (message.sourceToken != null && Object.hasOwnProperty.call(message, "sourceToken")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.sourceToken); + if (message.buildName != null && Object.hasOwnProperty.call(message, "buildName")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.buildName); return writer; }; @@ -5236,6 +6274,12 @@ case 6: message.buildId = reader.string(); break; + case 7: + message.sourceToken = reader.string(); + break; + case 8: + message.buildName = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -5300,6 +6344,12 @@ if (message.buildId != null && message.hasOwnProperty("buildId")) if (!$util.isString(message.buildId)) return "buildId: string expected"; + if (message.sourceToken != null && message.hasOwnProperty("sourceToken")) + if (!$util.isString(message.sourceToken)) + return "sourceToken: string expected"; + if (message.buildName != null && message.hasOwnProperty("buildName")) + if (!$util.isString(message.buildName)) + return "buildName: string expected"; return null; }; @@ -5356,6 +6406,10 @@ } if (object.buildId != null) message.buildId = String(object.buildId); + if (object.sourceToken != null) + message.sourceToken = String(object.sourceToken); + if (object.buildName != null) + message.buildName = String(object.buildName); return message; }; @@ -5383,6 +6437,8 @@ object.versionId = options.longs === String ? "0" : 0; object.updateTime = null; object.buildId = ""; + object.sourceToken = ""; + object.buildName = ""; } if (message.target != null && message.hasOwnProperty("target")) object.target = message.target; @@ -5399,6 +6455,10 @@ object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); if (message.buildId != null && message.hasOwnProperty("buildId")) object.buildId = message.buildId; + if (message.sourceToken != null && message.hasOwnProperty("sourceToken")) + object.sourceToken = message.sourceToken; + if (message.buildName != null && message.hasOwnProperty("buildName")) + object.buildName = message.buildName; return object; }; diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index 015c3b5b2e8..6f5b38ec656 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -12,7 +12,9 @@ "java_multiple_files": true, "java_outer_classname": "FunctionsOperationsProto", "java_package": "com.google.cloud.functions.v1", - "objc_class_prefix": "GCF" + "objc_class_prefix": "GCF", + "(google.api.resource_definition).type": "cloudkms.googleapis.com/CryptoKey", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" }, "nested": { "CloudFunctionsService": { @@ -335,6 +337,11 @@ "type": "string", "id": 17 }, + "buildEnvironmentVariables": { + "keyType": "string", + "type": "string", + "id": 28 + }, "network": { "type": "string", "id": 18 @@ -343,6 +350,10 @@ "type": "int32", "id": 20 }, + "minInstances": { + "type": "int32", + "id": 32 + }, "vpcConnector": { "type": "string", "id": 22 @@ -355,12 +366,54 @@ "type": "IngressSettings", "id": 24 }, + "kmsKeyName": { + "type": "string", + "id": 25, + "options": { + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + }, + "buildWorkerPool": { + "type": "string", + "id": 26 + }, "buildId": { "type": "string", "id": 27, "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "buildName": { + "type": "string", + "id": 33, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "secretEnvironmentVariables": { + "rule": "repeated", + "type": "SecretEnvVar", + "id": 29 + }, + "secretVolumes": { + "rule": "repeated", + "type": "SecretVolume", + "id": 30 + }, + "sourceToken": { + "type": "string", + "id": 31, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } + }, + "dockerRepository": { + "type": "string", + "id": 34, + "options": { + "(google.api.resource_reference).type": "artifactregistry.googleapis.com/Repository" + } } }, "nested": { @@ -460,6 +513,61 @@ } } }, + "SecretEnvVar": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "version": { + "type": "string", + "id": 4 + } + } + }, + "SecretVolume": { + "fields": { + "mountPath": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "versions": { + "rule": "repeated", + "type": "SecretVersion", + "id": 4 + } + }, + "nested": { + "SecretVersion": { + "fields": { + "version": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + } + } + }, "CreateFunctionRequest": { "fields": { "location": { @@ -494,6 +602,16 @@ } } }, + "CloudFunctionStatus": { + "values": { + "CLOUD_FUNCTION_STATUS_UNSPECIFIED": 0, + "ACTIVE": 1, + "OFFLINE": 2, + "DEPLOY_IN_PROGRESS": 3, + "DELETE_IN_PROGRESS": 4, + "UNKNOWN": 5 + } + }, "GetFunctionRequest": { "fields": { "name": { @@ -506,16 +624,6 @@ } } }, - "CloudFunctionStatus": { - "values": { - "CLOUD_FUNCTION_STATUS_UNSPECIFIED": 0, - "ACTIVE": 1, - "OFFLINE": 2, - "DEPLOY_IN_PROGRESS": 3, - "DELETE_IN_PROGRESS": 4, - "UNKNOWN": 5 - } - }, "ListFunctionsRequest": { "fields": { "parent": { @@ -669,6 +777,14 @@ "buildId": { "type": "string", "id": 6 + }, + "sourceToken": { + "type": "string", + "id": 7 + }, + "buildName": { + "type": "string", + "id": 8 } } } diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js new file mode 100644 index 00000000000..6f024e70445 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js @@ -0,0 +1,57 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name, data) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function to be called. + */ + // const name = 'abc123' + /** + * Required. Input to be passed to the function. + */ + // const data = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callCallFunction() { + // Construct request + const request = { + name, + data, + }; + + // Run request + const response = await functionsClient.callFunction(request); + console.log(response); + } + + callCallFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js new file mode 100644 index 00000000000..36207bd407d --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js @@ -0,0 +1,59 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(location, function1) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + */ + // const location = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + location, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js new file mode 100644 index 00000000000..ede7f4ed938 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js @@ -0,0 +1,53 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js new file mode 100644 index 00000000000..8fd843f078f --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js @@ -0,0 +1,56 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + */ + // const name = 'abc123' + /** + * The optional version of function. If not set, default, current version + * is used. + */ + // const versionId = 1234 + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = {}; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js new file mode 100644 index 00000000000..4bed14297d7 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js @@ -0,0 +1,51 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = {}; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js new file mode 100644 index 00000000000..c9a31182bc8 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js @@ -0,0 +1,52 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js new file mode 100644 index 00000000000..36af3da6043 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js @@ -0,0 +1,58 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(resource) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_async] + /** + * 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 Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await functionsClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js new file mode 100644 index 00000000000..0a305068bc6 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js @@ -0,0 +1,68 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callListFunctions() { + // Construct request + const request = {}; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js new file mode 100644 index 00000000000..f811d2e9e6c --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js @@ -0,0 +1,61 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(resource, policy) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_async] + /** + * 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 Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await functionsClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js new file mode 100644 index 00000000000..1c272edfd2a --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js @@ -0,0 +1,61 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(resource, permissions) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_async] + /** + * 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 = 'abc123' + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await functionsClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js new file mode 100644 index 00000000000..222438dff3f --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js @@ -0,0 +1,57 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(function1) { + // [START cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. New version of the function. + */ + // const function = {} + /** + * Required list of fields to be updated in this request. + */ + // const updateMask = {} + + // Imports the Functions library + const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; + + // Instantiates a client + const functionsClient = new CloudFunctionsServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index b59eeb842a1..2427b94e8f2 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -170,9 +170,15 @@ export class CloudFunctionsServiceClient { cloudFunctionPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/functions/{function}' ), + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), }; // Some of the methods on this service return "paged" results, @@ -381,6 +387,23 @@ export class CloudFunctionsServiceClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Returns a function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.get_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async + */ getFunction( request?: protos.google.cloud.functions.v1.IGetFunctionRequest, options?: CallOptions @@ -408,23 +431,6 @@ export class CloudFunctionsServiceClient { {} | null | undefined > ): void; - /** - * Returns a function with the given name from the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which details should be obtained. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [CloudFunction]{@link google.cloud.functions.v1.CloudFunction}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getFunction(request); - */ getFunction( request?: protos.google.cloud.functions.v1.IGetFunctionRequest, optionsOrCallback?: @@ -466,6 +472,28 @@ export class CloudFunctionsServiceClient { this.initialize(); return this.innerApiCalls.getFunction(request, options, callback); } + /** + * Synchronously invokes a deployed Cloud Function. To be used for testing + * purposes as very limited traffic is allowed. For more information on + * the actual limits, refer to + * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function to be called. + * @param {string} request.data + * Required. Input to be passed to the 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 an object representing [CallFunctionResponse]{@link google.cloud.functions.v1.CallFunctionResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.call_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async + */ callFunction( request?: protos.google.cloud.functions.v1.ICallFunctionRequest, options?: CallOptions @@ -493,28 +521,6 @@ export class CloudFunctionsServiceClient { {} | null | undefined > ): void; - /** - * Synchronously invokes a deployed Cloud Function. To be used for testing - * purposes as very limited traffic is allowed. For more information on - * the actual limits, refer to - * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function to be called. - * @param {string} request.data - * Required. Input to be passed to the 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 an object representing [CallFunctionResponse]{@link google.cloud.functions.v1.CallFunctionResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.callFunction(request); - */ callFunction( request?: protos.google.cloud.functions.v1.ICallFunctionRequest, optionsOrCallback?: @@ -556,37 +562,6 @@ export class CloudFunctionsServiceClient { this.initialize(); return this.innerApiCalls.callFunction(request, options, callback); } - generateUploadUrl( - request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | undefined, - {} | undefined - ] - >; - generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest - | null - | undefined, - {} | null | undefined - > - ): void; - generateUploadUrl( - request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, - callback: Callback< - protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, - | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Returns a signed URL for uploading a function source code. * For more information about the signed URL usage see: @@ -626,9 +601,40 @@ export class CloudFunctionsServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.generateUploadUrl(request); + * @example include:samples/generated/v1/cloud_functions_service.generate_upload_url.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async */ + generateUploadUrl( + request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | undefined, + {} | undefined + ] + >; + generateUploadUrl( + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v1.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; generateUploadUrl( request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, optionsOrCallback?: @@ -672,6 +678,31 @@ export class CloudFunctionsServiceClient { this.initialize(); return this.innerApiCalls.generateUploadUrl(request, options, callback); } + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * minutes after generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @param {number} request.versionId + * The optional version of function. If not set, default, current version + * is used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v1.GenerateDownloadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.generate_download_url.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async + */ generateDownloadUrl( request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, options?: CallOptions @@ -703,31 +734,6 @@ export class CloudFunctionsServiceClient { {} | null | undefined > ): void; - /** - * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within - * minutes after generation. - * For more information about the signed URL usage see: - * https://cloud.google.com/storage/docs/access-control/signed-urls - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The name of function for which source code Google Cloud Storage signed - * URL should be generated. - * @param {number} request.versionId - * The optional version of function. If not set, default, current version - * is used. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v1.GenerateDownloadUrlResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.generateDownloadUrl(request); - */ generateDownloadUrl( request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, optionsOrCallback?: @@ -771,6 +777,30 @@ export class CloudFunctionsServiceClient { this.initialize(); return this.innerApiCalls.generateDownloadUrl(request, options, callback); } + /** + * Sets the IAM access control policy on the specified function. + * Replaces any existing policy. + * + * @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 [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.set_iam_policy.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_async + */ setIamPolicy( request?: protos.google.iam.v1.ISetIamPolicyRequest, options?: CallOptions @@ -798,30 +828,6 @@ export class CloudFunctionsServiceClient { {} | null | undefined > ): void; - /** - * Sets the IAM access control policy on the specified function. - * Replaces any existing policy. - * - * @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 [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.setIamPolicy(request); - */ setIamPolicy( request?: protos.google.iam.v1.ISetIamPolicyRequest, optionsOrCallback?: @@ -861,6 +867,29 @@ export class CloudFunctionsServiceClient { this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } + /** + * Gets the IAM access control policy for a function. + * Returns an empty policy if the function 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 {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 [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.get_iam_policy.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_async + */ getIamPolicy( request?: protos.google.iam.v1.IGetIamPolicyRequest, options?: CallOptions @@ -888,29 +917,6 @@ export class CloudFunctionsServiceClient { {} | null | undefined > ): void; - /** - * Gets the IAM access control policy for a function. - * Returns an empty policy if the function 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 {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 [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getIamPolicy(request); - */ getIamPolicy( request?: protos.google.iam.v1.IGetIamPolicyRequest, optionsOrCallback?: @@ -950,33 +956,6 @@ export class CloudFunctionsServiceClient { this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } - 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; /** * Tests the specified permissions against the IAM access control policy * for a function. @@ -1000,9 +979,36 @@ export class CloudFunctionsServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example - * const [response] = await client.testIamPermissions(request); + * @example include:samples/generated/v1/cloud_functions_service.test_iam_permissions.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_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?: @@ -1043,6 +1049,30 @@ export class CloudFunctionsServiceClient { return this.innerApiCalls.testIamPermissions(request, options, callback); } + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.location + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + * @param {google.cloud.functions.v1.CloudFunction} request.function + * Required. Function to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.create_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async + */ createFunction( request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, options?: CallOptions @@ -1079,31 +1109,6 @@ export class CloudFunctionsServiceClient { {} | null | undefined > ): void; - /** - * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return - * `ALREADY_EXISTS` error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.location - * Required. The project and location in which the function should be created, specified - * in the format `projects/* /locations/*` - * @param {google.cloud.functions.v1.CloudFunction} request.function - * Required. Function to be created. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.createFunction(request); - * const [response] = await operation.promise(); - */ createFunction( request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, optionsOrCallback?: @@ -1161,11 +1166,8 @@ export class CloudFunctionsServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkCreateFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/cloud_functions_service.create_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async */ async checkCreateFunctionProgress( name: string @@ -1189,6 +1191,27 @@ export class CloudFunctionsServiceClient { protos.google.cloud.functions.v1.OperationMetadataV1 >; } + /** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v1.CloudFunction} request.function + * Required. New version of the function. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.update_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async + */ updateFunction( request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, options?: CallOptions @@ -1225,28 +1248,6 @@ export class CloudFunctionsServiceClient { {} | null | undefined > ): void; - /** - * Updates existing function. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.functions.v1.CloudFunction} request.function - * Required. New version of the function. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.updateFunction(request); - * const [response] = await operation.promise(); - */ updateFunction( request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, optionsOrCallback?: @@ -1304,11 +1305,8 @@ export class CloudFunctionsServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkUpdateFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/cloud_functions_service.update_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async */ async checkUpdateFunctionProgress( name: string @@ -1332,6 +1330,27 @@ export class CloudFunctionsServiceClient { protos.google.cloud.functions.v1.OperationMetadataV1 >; } + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/cloud_functions_service.delete_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async + */ deleteFunction( request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, options?: CallOptions @@ -1368,28 +1387,6 @@ export class CloudFunctionsServiceClient { {} | null | undefined > ): void; - /** - * Deletes a function with the given name from the specified project. If the - * given function is used by some trigger, the trigger will be updated to - * remove this function. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the function which should 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example - * const [operation] = await client.deleteFunction(request); - * const [response] = await operation.promise(); - */ deleteFunction( request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, optionsOrCallback?: @@ -1447,11 +1444,8 @@ export class CloudFunctionsServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. - * @example - * const decodedOperation = await checkDeleteFunctionProgress(name); - * console.log(decodedOperation.result); - * console.log(decodedOperation.done); - * console.log(decodedOperation.metadata); + * @example include:samples/generated/v1/cloud_functions_service.delete_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async */ async checkDeleteFunctionProgress( name: string @@ -1475,37 +1469,6 @@ export class CloudFunctionsServiceClient { protos.google.cloud.functions.v1.OperationMetadataV1 >; } - listFunctions( - request?: protos.google.cloud.functions.v1.IListFunctionsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.functions.v1.ICloudFunction[], - protos.google.cloud.functions.v1.IListFunctionsRequest | null, - protos.google.cloud.functions.v1.IListFunctionsResponse - ] - >; - listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - | protos.google.cloud.functions.v1.IListFunctionsResponse - | null - | undefined, - protos.google.cloud.functions.v1.ICloudFunction - > - ): void; - listFunctions( - request: protos.google.cloud.functions.v1.IListFunctionsRequest, - callback: PaginationCallback< - protos.google.cloud.functions.v1.IListFunctionsRequest, - | protos.google.cloud.functions.v1.IListFunctionsResponse - | null - | undefined, - protos.google.cloud.functions.v1.ICloudFunction - > - ): void; /** * Returns a list of functions that belong to the requested project. * @@ -1538,6 +1501,37 @@ export class CloudFunctionsServiceClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listFunctions( + request?: protos.google.cloud.functions.v1.IListFunctionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v1.ICloudFunction[], + protos.google.cloud.functions.v1.IListFunctionsRequest | null, + protos.google.cloud.functions.v1.IListFunctionsResponse + ] + >; + listFunctions( + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + | protos.google.cloud.functions.v1.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v1.ICloudFunction + > + ): void; + listFunctions( + request: protos.google.cloud.functions.v1.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v1.IListFunctionsRequest, + | protos.google.cloud.functions.v1.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v1.ICloudFunction + > + ): void; listFunctions( request?: protos.google.cloud.functions.v1.IListFunctionsRequest, optionsOrCallback?: @@ -1624,7 +1618,8 @@ export class CloudFunctionsServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listFunctions.createStream( this.innerApiCalls.listFunctions as gax.GaxCall, @@ -1663,11 +1658,8 @@ export class CloudFunctionsServiceClient { * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. - * @example - * const iterable = client.listFunctionsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1/cloud_functions_service.list_functions.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async */ listFunctionsAsync( request?: protos.google.cloud.functions.v1.IListFunctionsRequest, @@ -1681,8 +1673,8 @@ export class CloudFunctionsServiceClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listFunctions.asyncIterate( this.innerApiCalls['listFunctions'] as GaxCall, @@ -1746,6 +1738,77 @@ export class CloudFunctionsServiceClient { .function; } + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string + ) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .crypto_key; + } + /** * Return a fully-qualified location resource name string. * @@ -1782,6 +1845,58 @@ export class CloudFunctionsServiceClient { return this.pathTemplates.locationPathTemplate.match(locationName).location; } + /** + * Return a fully-qualified repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project: string, location: string, repository: string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .repository; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index e3960838a71..e90e44ed876 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -2016,6 +2016,83 @@ describe('v1.CloudFunctionsServiceClient', () => { }); }); + describe('cryptoKey', () => { + const fakePath = '/rendered/path/cryptoKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + }; + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('location', () => { const fakePath = '/rendered/path/location'; const expectedParameters = { @@ -2065,5 +2142,70 @@ describe('v1.CloudFunctionsServiceClient', () => { ); }); }); + + describe('repository', () => { + const fakePath = '/rendered/path/repository'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + repository: 'repositoryValue', + }; + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath( + 'projectValue', + 'locationValue', + 'repositoryValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, 'repositoryValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); }); From 7d607c79b10446c7ea80fb0585cd3e21078dfba5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 9 Dec 2021 22:42:27 +0000 Subject: [PATCH 086/123] build: add generated samples to .eslintignore (#125) --- packages/google-cloud-functions/.eslintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google-cloud-functions/.eslintignore b/packages/google-cloud-functions/.eslintignore index 9340ad9b86d..ea5b04aebe6 100644 --- a/packages/google-cloud-functions/.eslintignore +++ b/packages/google-cloud-functions/.eslintignore @@ -4,3 +4,4 @@ test/fixtures build/ docs/ protos/ +samples/generated/ From ed5e2b2e715928c0e2b0c6daf681881e9b0dd808 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 29 Dec 2021 19:56:25 +0000 Subject: [PATCH 087/123] docs(node): support "stable"/"preview" release level (#1312) (#128) --- packages/google-cloud-functions/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index 1c41a2b512c..aff9d113002 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -131,6 +131,8 @@ are addressed with the highest priority. + + More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages From 03f625026bd0fbd566a4a866ab757039abfb263f Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 30 Dec 2021 18:56:29 -0500 Subject: [PATCH 088/123] chore: add api_shortname and library_type to repo metadata (#127) Update .repo-metadata.json as required by go/library-data-integrity --- packages/google-cloud-functions/.repo-metadata.json | 6 ++++-- packages/google-cloud-functions/README.md | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json index 3a164dd5c6d..7ccff9e7070 100644 --- a/packages/google-cloud-functions/.repo-metadata.json +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -5,11 +5,13 @@ "api_id": "cloudfunctions.googleapis.com", "client_documentation": "https://cloud.google.com/nodejs/docs/reference/functions/latest", "repo": "googleapis/nodejs-functions", - "release_level": "ga", + "release_level": "stable", "requires_billing": false, "name_pretty": "Google Cloud Functions", "name": "nodejs-functions", "codeowner_team": "@googleapis/serverless-team", "default_version": "v1", - "language": "nodejs" + "language": "nodejs", + "api_shortname": "cloudfunctions", + "library_type": "GAPIC_AUTO" } diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index aff9d113002..7ca997f308e 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -4,7 +4,7 @@ # [Google Cloud Functions: Node.js Client](https://github.com/googleapis/nodejs-functions) -[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) + [![npm version](https://img.shields.io/npm/v/@google-cloud/functions.svg)](https://www.npmjs.org/package/@google-cloud/functions) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-functions/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-functions) @@ -121,10 +121,10 @@ _Legacy Node.js versions are supported as a best effort:_ This library follows [Semantic Versioning](http://semver.org/). -This library is considered to be **General Availability (GA)**. This means it -is stable; the code surface will not change in backwards-incompatible ways + +This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with -an extensive deprecation period. Issues and requests against **GA** libraries +an extensive deprecation period. Issues and requests against **stable** libraries are addressed with the highest priority. @@ -132,7 +132,6 @@ are addressed with the highest priority. - More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages From 0af33e7d88767cc205177ca29dc4e4e9d7f6d4fa Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:04:11 +0000 Subject: [PATCH 089/123] test(nodejs): remove 15 add 16 (#1322) (#131) --- packages/google-cloud-functions/README.md | 3 +-- packages/google-cloud-functions/protos/protos.d.ts | 2 +- packages/google-cloud-functions/protos/protos.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index 7ca997f308e..ddc7c573271 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -4,9 +4,8 @@ # [Google Cloud Functions: Node.js Client](https://github.com/googleapis/nodejs-functions) - +[![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/functions.svg)](https://www.npmjs.org/package/@google-cloud/functions) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-functions/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-functions) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 8a85a17cbc0..e4087f31be4 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 6f07958e29f..57087e6a3a3 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. From 0539a22d0ab48cd13071e7a1f96664f6f00be17e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 26 Jan 2022 19:54:36 +0000 Subject: [PATCH 090/123] chore: update v2.12.0 gapic-generator-typescript (#136) - [ ] Regenerate this pull request now. Committer: @summer-ji-eng PiperOrigin-RevId: 424244721 Source-Link: https://github.com/googleapis/googleapis/commit/4b6b01f507ebc3df95fdf8e1d76b0ae0ae33e52c Source-Link: https://github.com/googleapis/googleapis-gen/commit/8ac83fba606d008c7e8a42e7d55b6596ec4be35f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGFjODNmYmE2MDZkMDA4YzdlOGE0MmU3ZDU1YjY1OTZlYzRiZTM1ZiJ9 --- packages/google-cloud-functions/.jsdoc.js | 4 ++-- packages/google-cloud-functions/linkinator.config.json | 10 ++++++++-- .../v1/cloud_functions_service.call_function.js | 1 + .../v1/cloud_functions_service.create_function.js | 1 + .../v1/cloud_functions_service.delete_function.js | 1 + .../cloud_functions_service.generate_download_url.js | 4 +++- .../v1/cloud_functions_service.generate_upload_url.js | 4 +++- .../v1/cloud_functions_service.get_function.js | 1 + .../v1/cloud_functions_service.get_iam_policy.js | 1 + .../v1/cloud_functions_service.list_functions.js | 6 ++++-- .../v1/cloud_functions_service.set_iam_policy.js | 1 + .../v1/cloud_functions_service.test_iam_permissions.js | 1 + .../v1/cloud_functions_service.update_function.js | 1 + .../src/v1/cloud_functions_service_client.ts | 2 +- packages/google-cloud-functions/src/v1/index.ts | 2 +- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- packages/google-cloud-functions/system-test/install.ts | 2 +- .../test/gapic_cloud_functions_service_v1.ts | 2 +- 19 files changed, 34 insertions(+), 14 deletions(-) diff --git a/packages/google-cloud-functions/.jsdoc.js b/packages/google-cloud-functions/.jsdoc.js index c4f9aebce6f..9ded0c9e61c 100644 --- a/packages/google-cloud-functions/.jsdoc.js +++ b/packages/google-cloud-functions/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2021 Google LLC', + copyright: 'Copyright 2022 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/functions', diff --git a/packages/google-cloud-functions/linkinator.config.json b/packages/google-cloud-functions/linkinator.config.json index 0121dfa684f..befd23c8633 100644 --- a/packages/google-cloud-functions/linkinator.config.json +++ b/packages/google-cloud-functions/linkinator.config.json @@ -3,8 +3,14 @@ "skip": [ "https://codecov.io/gh/googleapis/", "www.googleapis.com", - "img.shields.io" + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" ], "silent": true, - "concurrency": 5 + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 } diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js index 6f024e70445..b70a56f31b2 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name, data) { diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js index 36207bd407d..cd97a482ee7 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(location, function1) { diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js index ede7f4ed938..6d4f891802c 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js index 8fd843f078f..879e9f76ae1 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -38,7 +39,8 @@ function main() { async function callGenerateDownloadUrl() { // Construct request - const request = {}; + const request = { + }; // Run request const response = await functionsClient.generateDownloadUrl(request); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js index 4bed14297d7..5362ebb05d6 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -33,7 +34,8 @@ function main() { async function callGenerateUploadUrl() { // Construct request - const request = {}; + const request = { + }; // Run request const response = await functionsClient.generateUploadUrl(request); diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js index c9a31182bc8..4a4cf419b04 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js index 36af3da6043..5bbb8d01b97 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(resource) { diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js index 0a305068bc6..ea49d4afc78 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -48,12 +49,13 @@ function main() { async function callListFunctions() { // Construct request - const request = {}; + const request = { + }; // Run request const iterable = await functionsClient.listFunctionsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js index f811d2e9e6c..c36ebfa4939 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(resource, policy) { diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js index 1c272edfd2a..a3a4b376815 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(resource, permissions) { diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js index 222438dff3f..fd3aa4fa8af 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(function1) { diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 2427b94e8f2..79aa4d601ac 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. diff --git a/packages/google-cloud-functions/src/v1/index.ts b/packages/google-cloud-functions/src/v1/index.ts index 3ac975fcc3e..6511c33a31e 100644 --- a/packages/google-cloud-functions/src/v1/index.ts +++ b/packages/google-cloud-functions/src/v1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js index d149eeb5715..d5ee6db257e 100644 --- a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. diff --git a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts index 38711df35e1..4bb11c8aa40 100644 --- a/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. diff --git a/packages/google-cloud-functions/system-test/install.ts b/packages/google-cloud-functions/system-test/install.ts index d2d61c0396f..6dd1eaadafa 100644 --- a/packages/google-cloud-functions/system-test/install.ts +++ b/packages/google-cloud-functions/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index e90e44ed876..11ea64b4bd1 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. From 86552240b471fdee164ce99f1e439ad90eb42514 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 31 Jan 2022 23:30:23 +0100 Subject: [PATCH 091/123] chore(deps): update dependency sinon to v13 (#138) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^12.0.0` -> `^13.0.0`](https://renovatebot.com/diffs/npm/sinon/12.0.1/13.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/compatibility-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/confidence-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v13.0.0`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#​1300) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v12.0.1...v13.0.0) - [`cf3d6c0c`](https://togithub.com/sinonjs/sinon/commit/cf3d6c0cd9689c0ee673b3daa8bf9abd70304392) Upgrade packages ([#​2431](https://togithub.com/sinonjs/sinon/issues/2431)) (Carl-Erik Kopseng) > - Update all @​sinonjs/ packages > > - Upgrade to fake-timers 9 > > - chore: ensure always using latest LTS release - [`41710467`](https://togithub.com/sinonjs/sinon/commit/417104670d575e96a1b645ea40ce763afa76fb1b) Adjust deploy scripts to archive old releases in a separate branch, move existing releases out of master ([#​2426](https://togithub.com/sinonjs/sinon/issues/2426)) (Joel Bradshaw) > Co-authored-by: Carl-Erik Kopseng - [`c80a7266`](https://togithub.com/sinonjs/sinon/commit/c80a72660e89d88b08275eff1028ecb9e26fd8e9) Bump node-fetch from 2.6.1 to 2.6.7 ([#​2430](https://togithub.com/sinonjs/sinon/issues/2430)) (dependabot\[bot]) > Co-authored-by: dependabot\[bot] <49699333+dependabot\[bot][@​users](https://togithub.com/users).noreply.github.com> - [`a00f14a9`](https://togithub.com/sinonjs/sinon/commit/a00f14a97dbe8c65afa89674e16ad73fc7d2fdc0) Add explicit export for `./*` ([#​2413](https://togithub.com/sinonjs/sinon/issues/2413)) (なつき) - [`b82ca7ad`](https://togithub.com/sinonjs/sinon/commit/b82ca7ad9b1add59007771f65a18ee34415de8ca) Bump cached-path-relative from 1.0.2 to 1.1.0 ([#​2428](https://togithub.com/sinonjs/sinon/issues/2428)) (dependabot\[bot]) - [`a9ea1427`](https://togithub.com/sinonjs/sinon/commit/a9ea142716c094ef3c432ecc4089f8207b8dd8b6) Add documentation for assert.calledOnceWithMatch ([#​2424](https://togithub.com/sinonjs/sinon/issues/2424)) (Mathias Schreck) - [`1d5ab86b`](https://togithub.com/sinonjs/sinon/commit/1d5ab86ba60e50dd69593ffed2bffd4b8faa0d38) Be more general in stripping off stack frames to fix Firefox tests ([#​2425](https://togithub.com/sinonjs/sinon/issues/2425)) (Joel Bradshaw) - [`56b06129`](https://togithub.com/sinonjs/sinon/commit/56b06129e223eae690265c37b1113067e2b31bdc) Check call count type ([#​2410](https://togithub.com/sinonjs/sinon/issues/2410)) (Joel Bradshaw) - [`7863e2df`](https://togithub.com/sinonjs/sinon/commit/7863e2dfdbda79e0a32e42af09e6539fc2f2b80f) Fix [#​2414](https://togithub.com/sinonjs/sinon/issues/2414): make Sinon available on homepage (Carl-Erik Kopseng) - [`fabaabdd`](https://togithub.com/sinonjs/sinon/commit/fabaabdda82f39a7f5b75b55bd56cf77b1cd4a8f) Bump nokogiri from 1.11.4 to 1.13.1 ([#​2423](https://togithub.com/sinonjs/sinon/issues/2423)) (dependabot\[bot]) - [`dbc0fbd2`](https://togithub.com/sinonjs/sinon/commit/dbc0fbd263c8419fa47f9c3b20cf47890a242d21) Bump shelljs from 0.8.4 to 0.8.5 ([#​2422](https://togithub.com/sinonjs/sinon/issues/2422)) (dependabot\[bot]) - [`fb8b3d72`](https://togithub.com/sinonjs/sinon/commit/fb8b3d72a85dc8fb0547f859baf3f03a22a039f7) Run Prettier (Carl-Erik Kopseng) - [`12a45939`](https://togithub.com/sinonjs/sinon/commit/12a45939e9b047b6d3663fe55f2eb383ec63c4e1) Fix 2377: Throw error when trying to stub non-configurable or non-writable properties ([#​2417](https://togithub.com/sinonjs/sinon/issues/2417)) (Stuart Dotson) > Fixes issue [#​2377](https://togithub.com/sinonjs/sinon/issues/2377) by throwing an error when trying to stub non-configurable or non-writable properties *Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2022-01-28.*
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 7110561a5ce..c4aa12b6147 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -54,7 +54,7 @@ "mocha": "^8.0.1", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^12.0.0", + "sinon": "^13.0.0", "ts-loader": "^9.0.0", "typescript": "^3.9.7", "webpack": "^5.0.0", From d1f36cfa81937ad3d52ed63f92a4ba64d4b38447 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 22:12:39 +0000 Subject: [PATCH 092/123] docs(nodejs): version support policy edits (#1346) (#140) --- packages/google-cloud-functions/README.md | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/google-cloud-functions/README.md b/packages/google-cloud-functions/README.md index ddc7c573271..1c9227b291e 100644 --- a/packages/google-cloud-functions/README.md +++ b/packages/google-cloud-functions/README.md @@ -99,21 +99,21 @@ also contains samples. Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). 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. -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. - -_Legacy Node.js versions are supported as a best effort:_ +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: -* Legacy versions will not be tested in continuous integration. -* Some security patches may not be able to be backported. -* Dependencies will not be kept up-to-date, and features will not be backported. +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. -#### Legacy tags available - -* `legacy-8`: install client libraries from this dist-tag for versions - compatible with Node.js 8. +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/functions@legacy-8` installs client libraries +for versions compatible with Node.js 8. ## Versioning From c9f5d475b141619c07837349155e5b017dabbf9b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 18 Feb 2022 02:06:52 +0000 Subject: [PATCH 093/123] docs(samples): include metadata file, add exclusions for samples to handwritten libraries (#141) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 429395631 Source-Link: https://github.com/googleapis/googleapis/commit/84594b35af0c38efcd6967e8179d801702ad96ff Source-Link: https://github.com/googleapis/googleapis-gen/commit/ed74f970fd82914874e6b27b04763cfa66bafe9b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWQ3NGY5NzBmZDgyOTE0ODc0ZTZiMjdiMDQ3NjNjZmE2NmJhZmU5YiJ9 --- .../cloud_functions_service.call_function.js | 9 +- ...cloud_functions_service.create_function.js | 9 +- ...cloud_functions_service.delete_function.js | 9 +- ...functions_service.generate_download_url.js | 9 +- ...d_functions_service.generate_upload_url.js | 9 +- .../cloud_functions_service.get_function.js | 9 +- .../cloud_functions_service.get_iam_policy.js | 9 +- .../cloud_functions_service.list_functions.js | 9 +- .../cloud_functions_service.set_iam_policy.js | 9 +- ..._functions_service.test_iam_permissions.js | 9 +- ...cloud_functions_service.update_function.js | 9 +- ...et_metadata.google.cloud.functions.v1.json | 491 ++++++++++++++++++ .../src/v1/cloud_functions_service_client.ts | 5 +- .../test/gapic_cloud_functions_service_v1.ts | 139 ++++- 14 files changed, 707 insertions(+), 27 deletions(-) create mode 100644 packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js index b70a56f31b2..cba235e3218 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js index cd97a482ee7..297f47f6484 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js index 6d4f891802c..13636fd8a05 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js index 879e9f76ae1..20aff9d0b03 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js index 5362ebb05d6..376d056619b 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js index 4a4cf419b04..9437697c724 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js index 5bbb8d01b97..235a5a51534 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js index ea49d4afc78..dcfa4314206 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js index c36ebfa4939..f0d7aaefe88 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js index a3a4b376815..de4aafd86ea 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js index fd3aa4fa8af..7262c9f2c70 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json new file mode 100644 index 00000000000..3a5611b8f50 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -0,0 +1,491 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async", + "title": "CloudFunctionsService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "cloud_functions_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.ListFunctionsResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async", + "title": "CloudFunctionsService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "cloud_functions_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.CloudFunction", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async", + "title": "CloudFunctionsService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "cloud_functions_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v1.CloudFunction" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async", + "title": "CloudFunctionsService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "cloud_functions_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v1.CloudFunction" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async", + "title": "CloudFunctionsService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "cloud_functions_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async", + "title": "CloudFunctionsService callFunction Sample", + "origin": "API_DEFINITION", + "description": " Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).", + "canonical": true, + "file": "cloud_functions_service.call_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CallFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.CallFunctionResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "CallFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async", + "title": "CloudFunctionsService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` * `x-goog-content-length-range: 0,104857600` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "cloud_functions_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.GenerateUploadUrlResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async", + "title": "CloudFunctionsService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "cloud_functions_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "version_id", + "type": "TYPE_UINT64" + } + ], + "resultType": ".google.cloud.functions.v1.GenerateDownloadUrlResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_async", + "title": "CloudFunctionsService setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the IAM access control policy on the specified function. Replaces any existing policy.", + "canonical": true, + "file": "cloud_functions_service.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.SetIamPolicy", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_async", + "title": "CloudFunctionsService getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.", + "canonical": true, + "file": "cloud_functions_service.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_async", + "title": "CloudFunctionsService testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.", + "canonical": true, + "file": "cloud_functions_service.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 79aa4d601ac..07d89ef3690 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -1904,9 +1904,8 @@ export class CloudFunctionsServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.cloudFunctionsServiceStub!.then(stub => { + if (this.cloudFunctionsServiceStub && !this._terminated) { + return this.cloudFunctionsServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index 11ea64b4bd1..347b8946403 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -189,13 +189,29 @@ describe('v1.CloudFunctionsServiceClient', () => { assert(client.cloudFunctionsServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.cloudFunctionsServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFunctionsServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -346,6 +362,23 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getFunction with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); }); describe('callFunction', () => { @@ -460,6 +493,23 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes callFunction with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.CallFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.callFunction(request), expectedError); + }); }); describe('generateUploadUrl', () => { @@ -574,6 +624,23 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); }); describe('generateDownloadUrl', () => { @@ -689,6 +756,23 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); }); describe('setIamPolicy', () => { @@ -803,6 +887,23 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes setIamPolicy with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); }); describe('getIamPolicy', () => { @@ -917,6 +1018,23 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getIamPolicy with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); }); describe('testIamPermissions', () => { @@ -1032,6 +1150,23 @@ describe('v1.CloudFunctionsServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes testIamPermissions with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); }); describe('createFunction', () => { From 7579b9579866736f527e3be255a4e12f456f4323 Mon Sep 17 00:00:00 2001 From: Dina Graves Portman Date: Tue, 22 Mar 2022 13:31:02 -0400 Subject: [PATCH 094/123] chore: update codeowners (#135) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update codeowners * Update .repo-metadata.json * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Benjamin E. Coe Co-authored-by: Owl Bot Co-authored-by: Ace Nassri Co-authored-by: Averi Kitsch --- packages/google-cloud-functions/.repo-metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json index 7ccff9e7070..489554162fa 100644 --- a/packages/google-cloud-functions/.repo-metadata.json +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -9,7 +9,7 @@ "requires_billing": false, "name_pretty": "Google Cloud Functions", "name": "nodejs-functions", - "codeowner_team": "@googleapis/serverless-team", + "codeowner_team": "@googleapis/aap-dpes", "default_version": "v1", "language": "nodejs", "api_shortname": "cloudfunctions", From 2efa121b783e8b933289114d8347221de948a7df Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 22 Mar 2022 18:16:36 +0000 Subject: [PATCH 095/123] chore: update v2.14.2 gapic-generator-typescript (#146) - [ ] Regenerate this pull request now. Committer: @summer-ji-eng PiperOrigin-RevId: 434859890 Source-Link: https://github.com/googleapis/googleapis/commit/bc2432d50cba657e95212122e3fa112591b5bec2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/930b673103e92523f8cfed38decd7d3afae8ebe7 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMwYjY3MzEwM2U5MjUyM2Y4Y2ZlZDM4ZGVjZDdkM2FmYWU4ZWJlNyJ9 --- packages/google-cloud-functions/owlbot.py | 6 +----- packages/google-cloud-functions/package.json | 2 +- .../src/v1/cloud_functions_service_client.ts | 6 +++--- .../test/gapic_cloud_functions_service_v1.ts | 7 ------- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/packages/google-cloud-functions/owlbot.py b/packages/google-cloud-functions/owlbot.py index 61bfcaa6795..f75b4adadd5 100644 --- a/packages/google-cloud-functions/owlbot.py +++ b/packages/google-cloud-functions/owlbot.py @@ -16,8 +16,4 @@ import synthtool.languages.node as node from pathlib import Path -def patch(library: Path): - s.replace(library / 'src/v1/cloud_functions_service_client.ts', "function:string", "function_: string") - s.replace(library / 'src/v1/cloud_functions_service_client.ts', "function: function", "function: function_") - -node.owlbot_main(staging_excludes=['README.md', 'package.json'], patch_staging=patch) \ No newline at end of file +node.owlbot_main(staging_excludes=['README.md', 'package.json']) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index c4aa12b6147..5fa8aff2aef 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,7 +39,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^2.24.1" + "google-gax": "^2.30.1" }, "devDependencies": { "@types/mocha": "^8.0.0", diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 07d89ef3690..367e4a28b8a 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -1691,14 +1691,14 @@ export class CloudFunctionsServiceClient { * * @param {string} project * @param {string} location - * @param {string} function + * @param {string} functionParam * @returns {string} Resource name string. */ - cloudFunctionPath(project: string, location: string, function_: string) { + cloudFunctionPath(project: string, location: string, functionParam: string) { return this.pathTemplates.cloudFunctionPathTemplate.render({ project: project, location: location, - function: function_, + function: functionParam, }); } diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index 347b8946403..0d578dba935 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -374,7 +374,6 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.cloud.functions.v1.GetFunctionRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getFunction(request), expectedError); @@ -505,7 +504,6 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.cloud.functions.v1.CallFunctionRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.callFunction(request), expectedError); @@ -636,7 +634,6 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() ); request.parent = ''; - const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateUploadUrl(request), expectedError); @@ -768,7 +765,6 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateDownloadUrl(request), expectedError); @@ -899,7 +895,6 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.iam.v1.SetIamPolicyRequest() ); request.resource = ''; - const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setIamPolicy(request), expectedError); @@ -1030,7 +1025,6 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.iam.v1.GetIamPolicyRequest() ); request.resource = ''; - const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getIamPolicy(request), expectedError); @@ -1162,7 +1156,6 @@ describe('v1.CloudFunctionsServiceClient', () => { new protos.google.iam.v1.TestIamPermissionsRequest() ); request.resource = ''; - const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.testIamPermissions(request), expectedError); From 640bc8dc204f4a87c8fec9732dd2e2b4ead5c12b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 5 Apr 2022 17:34:12 +0000 Subject: [PATCH 096/123] feat: AuditConfig for IAM v1 (#148) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 439356405 Source-Link: https://github.com/googleapis/googleapis/commit/afa2ba156bd5c83ad8168030ab801a8ca84ac819 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3e40c17e1510c95fab58fc2143ccb61cceca5989 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2U0MGMxN2UxNTEwYzk1ZmFiNThmYzIxNDNjY2I2MWNjZWNhNTk4OSJ9 --- .../v1/cloud_functions_service.get_iam_policy.js | 2 +- .../v1/cloud_functions_service.set_iam_policy.js | 7 +++++++ .../v1/snippet_metadata.google.cloud.functions.v1.json | 6 +++++- .../src/v1/cloud_functions_service_client.ts | 8 +++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js index 235a5a51534..8b9594a3d24 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js @@ -32,7 +32,7 @@ function main(resource) { // const resource = 'abc123' /** * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. + * `GetIamPolicy`. */ // const options = {} diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js index f0d7aaefe88..290607b6046 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js @@ -37,6 +37,13 @@ function main(resource, policy) { * might reject them. */ // const policy = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} // Imports the Functions library const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index 3a5611b8f50..b3d2bee8a6e 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -366,7 +366,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 66, "type": "FULL" } ], @@ -382,6 +382,10 @@ { "name": "policy", "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" } ], "resultType": ".google.iam.v1.Policy", diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 367e4a28b8a..cefeb99e05b 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -791,6 +791,12 @@ export class CloudFunctionsServiceClient { * 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 {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -879,7 +885,7 @@ export class CloudFunctionsServiceClient { * 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. + * `GetIamPolicy`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. From 1665f598a4ed64a8fff88a4353d0b95f230ae469 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 02:32:33 +0000 Subject: [PATCH 097/123] build(node): update client library version in samples metadata (#1356) (#157) * build(node): add feat in node post-processor to add client library version number in snippet metadata Co-authored-by: Benjamin E. Coe Source-Link: https://github.com/googleapis/synthtool/commit/d337b88dd1494365183718a2de0b7b4056b6fdfe Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:d106724ad2a96daa1b8d88de101ba50bdb30b8df62ffa0aa2b451d93b4556641 --- ...et_metadata.google.cloud.functions.v1.json | 944 +++++++++--------- 1 file changed, 472 insertions(+), 472 deletions(-) diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index b3d2bee8a6e..2eee58eddc4 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -1,495 +1,495 @@ { - "clientLibrary": { - "name": "nodejs-functions", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.functions.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async", - "title": "CloudFunctionsService listFunctions Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of functions that belong to the requested project.", - "canonical": true, - "file": "cloud_functions_service.list_functions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v1.ListFunctionsResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" - }, - "method": { - "shortName": "ListFunctions", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } + "clientLibrary": { + "name": "nodejs-functions", + "version": "1.2.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v1", + "version": "v1" + } + ] }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async", - "title": "CloudFunctionsService getFunction Sample", - "origin": "API_DEFINITION", - "description": " Returns a function with the given name from the requested project.", - "canonical": true, - "file": "cloud_functions_service.get_function.js", - "language": "JAVASCRIPT", - "segments": [ + "snippets": [ { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v1.CloudFunction", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async", + "title": "CloudFunctionsService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "cloud_functions_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.ListFunctionsResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.ListFunctions", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "GetFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async", - "title": "CloudFunctionsService createFunction Sample", - "origin": "API_DEFINITION", - "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", - "canonical": true, - "file": "cloud_functions_service.create_function.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", - "async": true, - "parameters": [ - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "function", - "type": ".google.cloud.functions.v1.CloudFunction" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async", + "title": "CloudFunctionsService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "cloud_functions_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.CloudFunction", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "CreateFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async", - "title": "CloudFunctionsService updateFunction Sample", - "origin": "API_DEFINITION", - "description": " Updates existing function.", - "canonical": true, - "file": "cloud_functions_service.update_function.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", - "async": true, - "parameters": [ - { - "name": "function", - "type": ".google.cloud.functions.v1.CloudFunction" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async", + "title": "CloudFunctionsService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "cloud_functions_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v1.CloudFunction" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "UpdateFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async", - "title": "CloudFunctionsService deleteFunction Sample", - "origin": "API_DEFINITION", - "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", - "canonical": true, - "file": "cloud_functions_service.delete_function.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async", + "title": "CloudFunctionsService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "cloud_functions_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v1.CloudFunction" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "DeleteFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async", - "title": "CloudFunctionsService callFunction Sample", - "origin": "API_DEFINITION", - "description": " Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).", - "canonical": true, - "file": "cloud_functions_service.call_function.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CallFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "data", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v1.CallFunctionResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async", + "title": "CloudFunctionsService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "cloud_functions_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.DeleteFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "CallFunction", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async", - "title": "CloudFunctionsService generateUploadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` * `x-goog-content-length-range: 0,104857600` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", - "canonical": true, - "file": "cloud_functions_service.generate_upload_url.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.functions.v1.GenerateUploadUrlResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async", + "title": "CloudFunctionsService callFunction Sample", + "origin": "API_DEFINITION", + "description": " Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).", + "canonical": true, + "file": "cloud_functions_service.call_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CallFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.CallFunctionResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "CallFunction", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.CallFunction", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "GenerateUploadUrl", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async", - "title": "CloudFunctionsService generateDownloadUrl Sample", - "origin": "API_DEFINITION", - "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", - "canonical": true, - "file": "cloud_functions_service.generate_download_url.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "version_id", - "type": "TYPE_UINT64" - } - ], - "resultType": ".google.cloud.functions.v1.GenerateDownloadUrlResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async", + "title": "CloudFunctionsService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` * `x-goog-content-length-range: 0,104857600` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "cloud_functions_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v1.GenerateUploadUrlResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "GenerateDownloadUrl", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_async", - "title": "CloudFunctionsService setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the IAM access control policy on the specified function. Replaces any existing policy.", - "canonical": true, - "file": "cloud_functions_service.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async", + "title": "CloudFunctionsService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "cloud_functions_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "version_id", + "type": "TYPE_UINT64" + } + ], + "resultType": ".google.cloud.functions.v1.GenerateDownloadUrlResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateDownloadUrl", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.SetIamPolicy", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_async", - "title": "CloudFunctionsService getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.", - "canonical": true, - "file": "cloud_functions_service.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_SetIamPolicy_async", + "title": "CloudFunctionsService setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the IAM access control policy on the specified function. Replaces any existing policy.", + "canonical": true, + "file": "cloud_functions_service.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.SetIamPolicy", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } - } - } - }, - { - "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_async", - "title": "CloudFunctionsService testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.", - "canonical": true, - "file": "cloud_functions_service.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "CloudFunctionsServiceClient", - "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_GetIamPolicy_async", + "title": "CloudFunctionsService getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.", + "canonical": true, + "file": "cloud_functions_service.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GetIamPolicy", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", - "service": { - "shortName": "CloudFunctionsService", - "fullName": "google.cloud.functions.v1.CloudFunctionsService" - } + { + "regionTag": "cloudfunctions_v1_generated_CloudFunctionsService_TestIamPermissions_async", + "title": "CloudFunctionsService testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.", + "canonical": true, + "file": "cloud_functions_service.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "CloudFunctionsServiceClient", + "fullName": "google.cloud.functions.v1.CloudFunctionsServiceClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.TestIamPermissions", + "service": { + "shortName": "CloudFunctionsService", + "fullName": "google.cloud.functions.v1.CloudFunctionsService" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file From 05491bf50b4ee49d25ab234bf541d627609a4937 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 09:45:48 -0400 Subject: [PATCH 098/123] chore(main): release 1.3.0 (#149) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 1.3.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- .../v1/snippet_metadata.google.cloud.functions.v1.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index f5fb61b6772..c82bd133b55 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.3.0](https://github.com/googleapis/nodejs-functions/compare/v1.2.0...v1.3.0) (2022-04-21) + + +### Features + +* AuditConfig for IAM v1 ([#148](https://github.com/googleapis/nodejs-functions/issues/148)) ([3c9131b](https://github.com/googleapis/nodejs-functions/commit/3c9131b24985f5e69501c51f068a68a7fea5e588)) + ## [1.2.0](https://www.github.com/googleapis/nodejs-functions/compare/v1.1.9...v1.2.0) (2021-09-16) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 5fa8aff2aef..ef864002015 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.2.0", + "version": "1.3.0", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index 2eee58eddc4..40d25a64e08 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "1.2.0", + "version": "1.3.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 7156e54a84d..ae31692a6f2 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.2.0" + "@google-cloud/functions": "^1.3.0" }, "devDependencies": { "c8": "^7.1.0", From 7f53d3b47ec14d4e2a93ae1861c4a63bbe1da014 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 3 May 2022 02:22:18 +0200 Subject: [PATCH 099/123] chore(deps): update dependency @types/mocha to v9 (#159) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/8.2.3/9.1.1) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/compatibility-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/confidence-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index ef864002015..b03753839bb 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -42,7 +42,7 @@ "google-gax": "^2.30.1" }, "devDependencies": { - "@types/mocha": "^8.0.0", + "@types/mocha": "^9.0.0", "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.2.1", From 70d3ba56dfcb02a8c140127854ef5f14308d7e9c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 9 May 2022 17:36:26 +0200 Subject: [PATCH 100/123] chore(deps): update dependency sinon to v14 (#162) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^13.0.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/sinon/13.0.2/14.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/compatibility-slim/13.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/confidence-slim/13.0.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v14.0.0`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#​1400) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v13.0.2...v14.0.0) - [`c2bbd826`](https://togithub.com/sinonjs/sinon/commit/c2bbd82641444eb5b32822489ae40f185afbbf00) Drop node 12 (Morgan Roderick) > And embrace Node 18 > > See https://nodejs.org/en/about/releases/ *Released by Morgan Roderick on 2022-05-07.*
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index b03753839bb..ff3187ccc99 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -54,7 +54,7 @@ "mocha": "^8.0.1", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", + "sinon": "^14.0.0", "ts-loader": "^9.0.0", "typescript": "^3.9.7", "webpack": "^5.0.0", From 7ff5e71e20eb4cadd64d6136c9ca8bbac49b19ce Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Mon, 16 May 2022 17:40:00 -0700 Subject: [PATCH 101/123] build!: update library to use Node 12 (#164) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat!: Update library to use Node 12 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- packages/google-cloud-functions/package.json | 10 +++++----- packages/google-cloud-functions/samples/package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index ff3187ccc99..031afcd612d 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,28 +39,28 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^2.30.1" + "google-gax": "^3.0.1" }, "devDependencies": { "@types/mocha": "^9.0.0", "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.2.1", - "gts": "^2.0.2", + "gts": "^3.1.0", "jsdoc": "^3.6.4", "jsdoc-fresh": "^1.0.2", "jsdoc-region-tag": "^1.0.4", "linkinator": "^2.1.1", - "mocha": "^8.0.1", + "mocha": "^9.2.2", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^14.0.0", "ts-loader": "^9.0.0", - "typescript": "^3.9.7", + "typescript": "^4.6.4", "webpack": "^5.0.0", "webpack-cli": "^4.0.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=12.0.0" } } diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index ae31692a6f2..e4bbac84f40 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=10" + "node": ">=12.0.0" }, "files": [ "*.js" From 593448bb9b8ec2af2e150fa2f79119fb40360df3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 10:08:22 -0700 Subject: [PATCH 102/123] chore(main): release 2.0.0 (#165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 2.0.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-functions/CHANGELOG.md | 11 +++++++++++ packages/google-cloud-functions/package.json | 2 +- .../snippet_metadata.google.cloud.functions.v1.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index c82bd133b55..894de89ff0e 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [2.0.0](https://github.com/googleapis/nodejs-functions/compare/v1.3.0...v2.0.0) (2022-05-17) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#164) + +### Build System + +* update library to use Node 12 ([#164](https://github.com/googleapis/nodejs-functions/issues/164)) ([dd4d94a](https://github.com/googleapis/nodejs-functions/commit/dd4d94a43269225225aaf5da37fc1176eb6c6999)) + ## [1.3.0](https://github.com/googleapis/nodejs-functions/compare/v1.2.0...v1.3.0) (2022-04-21) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 031afcd612d..d875a1a844e 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "1.3.0", + "version": "2.0.0", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index 40d25a64e08..2e03f700f19 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "1.3.0", + "version": "2.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index e4bbac84f40..035754fa4e3 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^1.3.0" + "@google-cloud/functions": "^2.0.0" }, "devDependencies": { "c8": "^7.1.0", From eeb355a1fa7f0529d3eea82c9081a1aecc2b4e71 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 9 Jun 2022 22:20:13 +0200 Subject: [PATCH 103/123] chore(deps): update dependency jsdoc-fresh to v2 (#168) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc-fresh](https://togithub.com/googleapis/jsdoc-fresh) | [`^1.0.2` -> `^2.0.0`](https://renovatebot.com/diffs/npm/jsdoc-fresh/1.1.1/2.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/compatibility-slim/1.1.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/confidence-slim/1.1.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/jsdoc-fresh ### [`v2.0.0`](https://togithub.com/googleapis/jsdoc-fresh/blob/HEAD/CHANGELOG.md#​200-httpsgithubcomgoogleapisjsdoc-freshcomparev111v200-2022-05-18) [Compare Source](https://togithub.com/googleapis/jsdoc-fresh/compare/v1.1.1...v2.0.0) ##### ⚠ BREAKING CHANGES - update library to use Node 12 ([#​108](https://togithub.com/googleapis/jsdoc-fresh/issues/108)) ##### Build System - update library to use Node 12 ([#​108](https://togithub.com/googleapis/jsdoc-fresh/issues/108)) ([e61c223](https://togithub.com/googleapis/jsdoc-fresh/commit/e61c2238db8900e339e5fe7fb8aea09642290182)) ##### [1.1.1](https://www.github.com/googleapis/jsdoc-fresh/compare/v1.1.0...v1.1.1) (2021-08-11) ##### Bug Fixes - **build:** migrate to using main branch ([#​83](https://www.togithub.com/googleapis/jsdoc-fresh/issues/83)) ([9474adb](https://www.github.com/googleapis/jsdoc-fresh/commit/9474adbf0d559d319ff207397ba2be6b557999ac))
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index d875a1a844e..b7c825b3284 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -48,7 +48,7 @@ "c8": "^7.2.1", "gts": "^3.1.0", "jsdoc": "^3.6.4", - "jsdoc-fresh": "^1.0.2", + "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^1.0.4", "linkinator": "^2.1.1", "mocha": "^9.2.2", From 715ff106d0e56fa270e85f8b9ff0df516d336059 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 9 Jun 2022 22:34:20 +0200 Subject: [PATCH 104/123] chore(deps): update dependency jsdoc-region-tag to v2 (#169) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc-region-tag](https://togithub.com/googleapis/jsdoc-region-tag) | [`^1.0.4` -> `^2.0.0`](https://renovatebot.com/diffs/npm/jsdoc-region-tag/1.3.1/2.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/compatibility-slim/1.3.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/confidence-slim/1.3.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/jsdoc-region-tag ### [`v2.0.0`](https://togithub.com/googleapis/jsdoc-region-tag/blob/HEAD/CHANGELOG.md#​200-httpsgithubcomgoogleapisjsdoc-region-tagcomparev131v200-2022-05-20) [Compare Source](https://togithub.com/googleapis/jsdoc-region-tag/compare/v1.3.1...v2.0.0) ##### ⚠ BREAKING CHANGES - update library to use Node 12 ([#​107](https://togithub.com/googleapis/jsdoc-region-tag/issues/107)) ##### Build System - update library to use Node 12 ([#​107](https://togithub.com/googleapis/jsdoc-region-tag/issues/107)) ([5b51796](https://togithub.com/googleapis/jsdoc-region-tag/commit/5b51796771984cf8b978990025f14faa03c19923)) ##### [1.3.1](https://www.github.com/googleapis/jsdoc-region-tag/compare/v1.3.0...v1.3.1) (2021-08-11) ##### Bug Fixes - **build:** migrate to using main branch ([#​79](https://www.togithub.com/googleapis/jsdoc-region-tag/issues/79)) ([5050615](https://www.github.com/googleapis/jsdoc-region-tag/commit/50506150b7758592df5e389c6a5c3d82b3b20881))
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index b7c825b3284..2e0f276a5ec 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -49,7 +49,7 @@ "gts": "^3.1.0", "jsdoc": "^3.6.4", "jsdoc-fresh": "^2.0.0", - "jsdoc-region-tag": "^1.0.4", + "jsdoc-region-tag": "^2.0.0", "linkinator": "^2.1.1", "mocha": "^9.2.2", "null-loader": "^4.0.0", From f2e2b1d3b64a705d9b835c19c90568ca4f822de3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 10 Jun 2022 12:04:43 -0400 Subject: [PATCH 105/123] feat: added support for CMEK (#166) PiperOrigin-RevId: 453234231 Source-Link: https://github.com/googleapis/googleapis/commit/d180952b2b797b9a8373647b14e0e990109d57a2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/836ff24b7e881ef46acd17836c46ed1a9832b195 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODM2ZmYyNGI3ZTg4MWVmNDZhY2QxNzgzNmM0NmVkMWE5ODMyYjE5NSJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Benjamin E. Coe --- .../google/cloud/functions/v1/functions.proto | 105 ++++++++++----- .../cloud/functions/v1/operations.proto | 3 +- .../google-cloud-functions/protos/protos.d.ts | 39 ++++-- .../google-cloud-functions/protos/protos.js | 125 ++++++++++++++---- .../google-cloud-functions/protos/protos.json | 38 ++++-- ...d_functions_service.generate_upload_url.js | 18 +++ ...cloud_functions_service.update_function.js | 2 +- ...et_metadata.google.cloud.functions.v1.json | 6 +- .../src/v1/cloud_functions_service_client.ts | 20 ++- 9 files changed, 278 insertions(+), 78 deletions(-) diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto index 29693ddaa3f..7592f3bed90 100644 --- a/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. @@ -191,7 +191,6 @@ service CloudFunctionsService { // Describes a Cloud Function that contains user computation executed in // response to an event. It encapsulate function and triggers configurations. -// Next tag: 36 message CloudFunction { option (google.api.resource) = { type: "cloudfunctions.googleapis.com/CloudFunction" @@ -233,6 +232,23 @@ message CloudFunction { ALLOW_INTERNAL_AND_GCLB = 3; } + // Docker Registry to use for storing function Docker images. + enum DockerRegistry { + // Unspecified. + DOCKER_REGISTRY_UNSPECIFIED = 0; + + // Docker images will be stored in multi-regional Container Registry + // repositories named `gcf`. + CONTAINER_REGISTRY = 1; + + // Docker images will be stored in regional Artifact Registry repositories. + // By default, GCF will create and use repositories named `gcf-artifacts` + // in every region in which a function is deployed. But the repository to + // use can also be specified by the user using the `docker_repository` + // field. + ARTIFACT_REGISTRY = 2; + } + // A user-defined name of the function. Function names must be unique // globally and match pattern `projects/*/locations/*/functions/*` string name = 1; @@ -380,8 +396,9 @@ message CloudFunction { // the `docker_repository` field that was created with the same KMS crypto // key. // - // The following service accounts need to be granted Cloud KMS crypto key - // encrypter/decrypter roles on the key. + // The following service accounts need to be granted the role 'Cloud KMS + // CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' + // on the Key/KeyRing/Project/Organization (least access preferred). // // 1. Google Cloud Functions service account // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - @@ -450,6 +467,14 @@ message CloudFunction { string docker_repository = 34 [(google.api.resource_reference) = { type: "artifactregistry.googleapis.com/Repository" }]; + + // Docker Registry to use for this deployment. + // + // If `docker_repository` field is specified, this field will be automatically + // set as `ARTIFACT_REGISTRY`. + // If unspecified, it currently defaults to `CONTAINER_REGISTRY`. + // This field may be overridden by the backend for eligible deployments. + DockerRegistry docker_registry = 35; } // Describes SourceRepository, used to represent parameters related to @@ -575,10 +600,31 @@ message FailurePolicy { } } +// Describes the current stage of a deployment. +enum CloudFunctionStatus { + // Not specified. Invalid state. + CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function isn’t serving. + OFFLINE = 2; + + // Function is being created or updated. + DEPLOY_IN_PROGRESS = 3; + + // Function is being deleted. + DELETE_IN_PROGRESS = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; +} + // Configuration for a secret environment variable. It has the information // necessary to fetch the secret value from secret manager and expose it as an -// environment variable. Secret value is not a part of the configuration. Secret -// values are only fetched when a new clone starts. +// environment variable. message SecretEnvVar { // Name of the environment variable. string key = 1; @@ -594,7 +640,7 @@ message SecretEnvVar { // Version of the secret (version number or the string 'latest'). It is // recommended to use a numeric version for secret environment variables as - // any updates to the secret value is not reflected until new clones start. + // any updates to the secret value is not reflected until new instances start. string version = 4; } @@ -662,32 +708,10 @@ message UpdateFunctionRequest { // Required. New version of the function. CloudFunction function = 1 [(google.api.field_behavior) = REQUIRED]; - // Required list of fields to be updated in this request. + // Required. The list of fields in `CloudFunction` that have to be updated. google.protobuf.FieldMask update_mask = 2; } -// Describes the current stage of a deployment. -enum CloudFunctionStatus { - // Not specified. Invalid state. - CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0; - - // Function has been successfully deployed and is serving. - ACTIVE = 1; - - // Function deployment failed and the function isn’t serving. - OFFLINE = 2; - - // Function is being created or updated. - DEPLOY_IN_PROGRESS = 3; - - // Function is being deleted. - DELETE_IN_PROGRESS = 4; - - // Function deployment failed and the function serving state is undefined. - // The function should be updated or deleted to move it out of this state. - UNKNOWN = 5; -} - // Request for the `GetFunction` method. message GetFunctionRequest { // Required. The name of the function which details should be obtained. @@ -781,6 +805,27 @@ message GenerateUploadUrlRequest { // The project and location in which the Google Cloud Storage signed URL // should be generated, specified in the format `projects/*/locations/*`. string parent = 1; + + // Resource name of a KMS crypto key (managed by the user) used to + // encrypt/decrypt function source code objects in staging Cloud Storage + // buckets. When you generate an upload url and upload your source code, it + // gets copied to a staging Cloud Storage bucket in an internal regional + // project. The source code is then copied to a versioned directory in the + // sources bucket in the consumer project during the function deployment. + // + // It must match the pattern + // `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + // + // The Google Cloud Functions service account + // (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + // (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + // Key/KeyRing/Project/Organization (least access preferred). GCF will + // delegate access to the Google Storage service account in the internal + // project. + string kms_key_name = 2 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; } // Response of `GenerateSourceUploadUrl` method. diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto index 183957cca2c..9d634e782f7 100644 --- a/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. @@ -18,7 +18,6 @@ package google.cloud.functions.v1; import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v1;functions"; option java_multiple_files = true; diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index e4087f31be4..a915969ca4d 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -379,6 +379,9 @@ export namespace google { /** CloudFunction dockerRepository */ dockerRepository?: (string|null); + + /** CloudFunction dockerRegistry */ + dockerRegistry?: (google.cloud.functions.v1.CloudFunction.DockerRegistry|keyof typeof google.cloud.functions.v1.CloudFunction.DockerRegistry|null); } /** Represents a CloudFunction. */ @@ -486,6 +489,9 @@ export namespace google { /** CloudFunction dockerRepository. */ public dockerRepository: string; + /** CloudFunction dockerRegistry. */ + public dockerRegistry: (google.cloud.functions.v1.CloudFunction.DockerRegistry|keyof typeof google.cloud.functions.v1.CloudFunction.DockerRegistry); + /** CloudFunction sourceCode. */ public sourceCode?: ("sourceArchiveUrl"|"sourceRepository"|"sourceUploadUrl"); @@ -579,6 +585,13 @@ export namespace google { ALLOW_INTERNAL_ONLY = 2, ALLOW_INTERNAL_AND_GCLB = 3 } + + /** DockerRegistry enum. */ + enum DockerRegistry { + DOCKER_REGISTRY_UNSPECIFIED = 0, + CONTAINER_REGISTRY = 1, + ARTIFACT_REGISTRY = 2 + } } /** Properties of a SourceRepository. */ @@ -1071,6 +1084,16 @@ export namespace google { } } + /** CloudFunctionStatus enum. */ + enum CloudFunctionStatus { + CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0, + ACTIVE = 1, + OFFLINE = 2, + DEPLOY_IN_PROGRESS = 3, + DELETE_IN_PROGRESS = 4, + UNKNOWN = 5 + } + /** Properties of a SecretEnvVar. */ interface ISecretEnvVar { @@ -1578,16 +1601,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** CloudFunctionStatus enum. */ - enum CloudFunctionStatus { - CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0, - ACTIVE = 1, - OFFLINE = 2, - DEPLOY_IN_PROGRESS = 3, - DELETE_IN_PROGRESS = 4, - UNKNOWN = 5 - } - /** Properties of a GetFunctionRequest. */ interface IGetFunctionRequest { @@ -2175,6 +2188,9 @@ export namespace google { /** GenerateUploadUrlRequest parent */ parent?: (string|null); + + /** GenerateUploadUrlRequest kmsKeyName */ + kmsKeyName?: (string|null); } /** Represents a GenerateUploadUrlRequest. */ @@ -2189,6 +2205,9 @@ export namespace google { /** GenerateUploadUrlRequest parent. */ public parent: string; + /** GenerateUploadUrlRequest kmsKeyName. */ + public kmsKeyName: string; + /** * Creates a new GenerateUploadUrlRequest instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 57087e6a3a3..16156c91fa5 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -502,6 +502,7 @@ * @property {Array.|null} [secretVolumes] CloudFunction secretVolumes * @property {string|null} [sourceToken] CloudFunction sourceToken * @property {string|null} [dockerRepository] CloudFunction dockerRepository + * @property {google.cloud.functions.v1.CloudFunction.DockerRegistry|null} [dockerRegistry] CloudFunction dockerRegistry */ /** @@ -780,6 +781,14 @@ */ CloudFunction.prototype.dockerRepository = ""; + /** + * CloudFunction dockerRegistry. + * @member {google.cloud.functions.v1.CloudFunction.DockerRegistry} dockerRegistry + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.dockerRegistry = 0; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -898,6 +907,8 @@ writer.uint32(/* id 33, wireType 2 =*/266).string(message.buildName); if (message.dockerRepository != null && Object.hasOwnProperty.call(message, "dockerRepository")) writer.uint32(/* id 34, wireType 2 =*/274).string(message.dockerRepository); + if (message.dockerRegistry != null && Object.hasOwnProperty.call(message, "dockerRegistry")) + writer.uint32(/* id 35, wireType 0 =*/280).int32(message.dockerRegistry); return writer; }; @@ -1089,6 +1100,9 @@ case 34: message.dockerRepository = reader.string(); break; + case 35: + message.dockerRegistry = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -1299,6 +1313,15 @@ if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) if (!$util.isString(message.dockerRepository)) return "dockerRepository: string expected"; + if (message.dockerRegistry != null && message.hasOwnProperty("dockerRegistry")) + switch (message.dockerRegistry) { + default: + return "dockerRegistry: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -1483,6 +1506,20 @@ message.sourceToken = String(object.sourceToken); if (object.dockerRepository != null) message.dockerRepository = String(object.dockerRepository); + switch (object.dockerRegistry) { + case "DOCKER_REGISTRY_UNSPECIFIED": + case 0: + message.dockerRegistry = 0; + break; + case "CONTAINER_REGISTRY": + case 1: + message.dockerRegistry = 1; + break; + case "ARTIFACT_REGISTRY": + case 2: + message.dockerRegistry = 2; + break; + } return message; }; @@ -1535,6 +1572,7 @@ object.minInstances = 0; object.buildName = ""; object.dockerRepository = ""; + object.dockerRegistry = options.enums === String ? "DOCKER_REGISTRY_UNSPECIFIED" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -1634,6 +1672,8 @@ object.buildName = message.buildName; if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) object.dockerRepository = message.dockerRepository; + if (message.dockerRegistry != null && message.hasOwnProperty("dockerRegistry")) + object.dockerRegistry = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.DockerRegistry[message.dockerRegistry] : message.dockerRegistry; return object; }; @@ -1682,6 +1722,22 @@ return values; })(); + /** + * DockerRegistry enum. + * @name google.cloud.functions.v1.CloudFunction.DockerRegistry + * @enum {number} + * @property {number} DOCKER_REGISTRY_UNSPECIFIED=0 DOCKER_REGISTRY_UNSPECIFIED value + * @property {number} CONTAINER_REGISTRY=1 CONTAINER_REGISTRY value + * @property {number} ARTIFACT_REGISTRY=2 ARTIFACT_REGISTRY value + */ + CloudFunction.DockerRegistry = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DOCKER_REGISTRY_UNSPECIFIED"] = 0; + values[valuesById[1] = "CONTAINER_REGISTRY"] = 1; + values[valuesById[2] = "ARTIFACT_REGISTRY"] = 2; + return values; + })(); + return CloudFunction; })(); @@ -2769,6 +2825,28 @@ return FailurePolicy; })(); + /** + * CloudFunctionStatus enum. + * @name google.cloud.functions.v1.CloudFunctionStatus + * @enum {number} + * @property {number} CLOUD_FUNCTION_STATUS_UNSPECIFIED=0 CLOUD_FUNCTION_STATUS_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} OFFLINE=2 OFFLINE value + * @property {number} DEPLOY_IN_PROGRESS=3 DEPLOY_IN_PROGRESS value + * @property {number} DELETE_IN_PROGRESS=4 DELETE_IN_PROGRESS value + * @property {number} UNKNOWN=5 UNKNOWN value + */ + v1.CloudFunctionStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLOUD_FUNCTION_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "OFFLINE"] = 2; + values[valuesById[3] = "DEPLOY_IN_PROGRESS"] = 3; + values[valuesById[4] = "DELETE_IN_PROGRESS"] = 4; + values[valuesById[5] = "UNKNOWN"] = 5; + return values; + })(); + v1.SecretEnvVar = (function() { /** @@ -3944,28 +4022,6 @@ return UpdateFunctionRequest; })(); - /** - * CloudFunctionStatus enum. - * @name google.cloud.functions.v1.CloudFunctionStatus - * @enum {number} - * @property {number} CLOUD_FUNCTION_STATUS_UNSPECIFIED=0 CLOUD_FUNCTION_STATUS_UNSPECIFIED value - * @property {number} ACTIVE=1 ACTIVE value - * @property {number} OFFLINE=2 OFFLINE value - * @property {number} DEPLOY_IN_PROGRESS=3 DEPLOY_IN_PROGRESS value - * @property {number} DELETE_IN_PROGRESS=4 DELETE_IN_PROGRESS value - * @property {number} UNKNOWN=5 UNKNOWN value - */ - v1.CloudFunctionStatus = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CLOUD_FUNCTION_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "ACTIVE"] = 1; - values[valuesById[2] = "OFFLINE"] = 2; - values[valuesById[3] = "DEPLOY_IN_PROGRESS"] = 3; - values[valuesById[4] = "DELETE_IN_PROGRESS"] = 4; - values[valuesById[5] = "UNKNOWN"] = 5; - return values; - })(); - v1.GetFunctionRequest = (function() { /** @@ -5291,6 +5347,7 @@ * @memberof google.cloud.functions.v1 * @interface IGenerateUploadUrlRequest * @property {string|null} [parent] GenerateUploadUrlRequest parent + * @property {string|null} [kmsKeyName] GenerateUploadUrlRequest kmsKeyName */ /** @@ -5316,6 +5373,14 @@ */ GenerateUploadUrlRequest.prototype.parent = ""; + /** + * GenerateUploadUrlRequest kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @instance + */ + GenerateUploadUrlRequest.prototype.kmsKeyName = ""; + /** * Creates a new GenerateUploadUrlRequest instance using the specified properties. * @function create @@ -5342,6 +5407,8 @@ writer = $Writer.create(); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kmsKeyName); return writer; }; @@ -5379,6 +5446,9 @@ case 1: message.parent = reader.string(); break; + case 2: + message.kmsKeyName = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -5417,6 +5487,9 @@ if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; return null; }; @@ -5434,6 +5507,8 @@ var message = new $root.google.cloud.functions.v1.GenerateUploadUrlRequest(); if (object.parent != null) message.parent = String(object.parent); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); return message; }; @@ -5450,10 +5525,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.parent = ""; + object.kmsKeyName = ""; + } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; return object; }; diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index 6f5b38ec656..6cd02f265c8 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -414,6 +414,10 @@ "options": { "(google.api.resource_reference).type": "artifactregistry.googleapis.com/Repository" } + }, + "dockerRegistry": { + "type": "DockerRegistry", + "id": 35 } }, "nested": { @@ -431,6 +435,13 @@ "ALLOW_INTERNAL_ONLY": 2, "ALLOW_INTERNAL_AND_GCLB": 3 } + }, + "DockerRegistry": { + "values": { + "DOCKER_REGISTRY_UNSPECIFIED": 0, + "CONTAINER_REGISTRY": 1, + "ARTIFACT_REGISTRY": 2 + } } } }, @@ -513,6 +524,16 @@ } } }, + "CloudFunctionStatus": { + "values": { + "CLOUD_FUNCTION_STATUS_UNSPECIFIED": 0, + "ACTIVE": 1, + "OFFLINE": 2, + "DEPLOY_IN_PROGRESS": 3, + "DELETE_IN_PROGRESS": 4, + "UNKNOWN": 5 + } + }, "SecretEnvVar": { "fields": { "key": { @@ -602,16 +623,6 @@ } } }, - "CloudFunctionStatus": { - "values": { - "CLOUD_FUNCTION_STATUS_UNSPECIFIED": 0, - "ACTIVE": 1, - "OFFLINE": 2, - "DEPLOY_IN_PROGRESS": 3, - "DELETE_IN_PROGRESS": 4, - "UNKNOWN": 5 - } - }, "GetFunctionRequest": { "fields": { "name": { @@ -713,6 +724,13 @@ "parent": { "type": "string", "id": 1 + }, + "kmsKeyName": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } } } }, diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js index 376d056619b..963f7b8805b 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js @@ -30,6 +30,24 @@ function main() { * should be generated, specified in the format `projects/* /locations/*`. */ // const parent = 'abc123' + /** + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in staging Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to a staging Cloud Storage bucket in an internal regional + * project. The source code is then copied to a versioned directory in the + * sources bucket in the consumer project during the function deployment. + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * project. + */ + // const kmsKeyName = 'abc123' // Imports the Functions library const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1; diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js index 7262c9f2c70..a9a915eb558 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js @@ -30,7 +30,7 @@ function main(function1) { */ // const function = {} /** - * Required list of fields to be updated in this request. + * Required. The list of fields in `CloudFunction` that have to be updated. */ // const updateMask = {} diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index 2e03f700f19..a82012d07a8 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -282,7 +282,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 68, "type": "FULL" } ], @@ -294,6 +294,10 @@ { "name": "parent", "type": "TYPE_STRING" + }, + { + "name": "kms_key_name", + "type": "TYPE_STRING" } ], "resultType": ".google.cloud.functions.v1.GenerateUploadUrlResponse", diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index cefeb99e05b..bc985634140 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -594,6 +594,24 @@ export class CloudFunctionsServiceClient { * @param {string} request.parent * The project and location in which the Google Cloud Storage signed URL * should be generated, specified in the format `projects/* /locations/*`. + * @param {string} request.kmsKeyName + * Resource name of a KMS crypto key (managed by the user) used to + * encrypt/decrypt function source code objects in staging Cloud Storage + * buckets. When you generate an upload url and upload your source code, it + * gets copied to a staging Cloud Storage bucket in an internal regional + * project. The source code is then copied to a versioned directory in the + * sources bucket in the consumer project during the function deployment. + * + * It must match the pattern + * `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. + * + * The Google Cloud Functions service account + * (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be + * granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter + * (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the + * Key/KeyRing/Project/Organization (least access preferred). GCF will + * delegate access to the Google Storage service account in the internal + * 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. @@ -1205,7 +1223,7 @@ export class CloudFunctionsServiceClient { * @param {google.cloud.functions.v1.CloudFunction} request.function * Required. New version of the function. * @param {google.protobuf.FieldMask} request.updateMask - * Required list of fields to be updated in this request. + * Required. The list of fields in `CloudFunction` that have 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. From 3670b129d9ab52ade275bbb5ce42dac14a1b5152 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 15:09:38 -0400 Subject: [PATCH 106/123] feat: generating GAPIC libraries for Google Cloud Functions v2beta (#171) feat: generating GAPIC libraries for Google Cloud Functions v2alpha PiperOrigin-RevId: 454899846 Source-Link: https://github.com/googleapis/googleapis/commit/7088e389a84dc95c3037950a06a00b808edac619 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c3673f892c803b9c3f17841bcdee7db6b3179444 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzM2NzNmODkyYzgwM2I5YzNmMTc4NDFiY2RlZTdkYjZiMzE3OTQ0NCJ9 PiperOrigin-RevId: 454900284 Source-Link: https://github.com/googleapis/googleapis/commit/05576c87b78caafac9774b26d49db704c35cf0ee Source-Link: https://github.com/googleapis/googleapis-gen/commit/5b2f0e36d27aa58fbde15d1e7ab7138cf5ea837a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWIyZjBlMzZkMjdhYTU4ZmJkZTE1ZDFlN2FiNzEzOGNmNWVhODM3YSJ9 Co-authored-by: Owl Bot --- .../cloud/functions/v2alpha/functions.proto | 1033 + .../cloud/functions/v2beta/functions.proto | 1033 + .../google-cloud-functions/protos/protos.d.ts | 6672 ++++++ .../google-cloud-functions/protos/protos.js | 16752 ++++++++++++++++ .../google-cloud-functions/protos/protos.json | 1970 ++ .../function_service.create_function.js | 72 + .../function_service.delete_function.js | 59 + .../function_service.generate_download_url.js | 59 + .../function_service.generate_upload_url.js | 59 + .../v2alpha/function_service.get_function.js | 58 + .../function_service.list_functions.js | 87 + .../v2alpha/function_service.list_runtimes.js | 64 + .../function_service.update_function.js | 65 + ...tadata.google.cloud.functions.v2alpha.json | 367 + .../function_service.create_function.js | 72 + .../function_service.delete_function.js | 59 + .../function_service.generate_download_url.js | 59 + .../function_service.generate_upload_url.js | 59 + .../v2beta/function_service.get_function.js | 58 + .../v2beta/function_service.list_functions.js | 87 + .../v2beta/function_service.list_runtimes.js | 64 + .../function_service.update_function.js | 65 + ...etadata.google.cloud.functions.v2beta.json | 367 + packages/google-cloud-functions/src/index.ts | 6 +- .../src/v2alpha/function_service_client.ts | 2407 +++ .../function_service_client_config.json | 58 + .../v2alpha/function_service_proto_list.json | 3 + .../src/v2alpha/gapic_metadata.json | 107 + .../src/v2alpha/index.ts | 19 + .../src/v2beta/function_service_client.ts | 2407 +++ .../function_service_client_config.json | 58 + .../v2beta/function_service_proto_list.json | 3 + .../src/v2beta/gapic_metadata.json | 107 + .../src/v2beta/index.ts | 19 + .../test/gapic_function_service_v2alpha.ts | 3117 +++ .../test/gapic_function_service_v2beta.ts | 3117 +++ 36 files changed, 40666 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-functions/protos/google/cloud/functions/v2alpha/functions.proto create mode 100644 packages/google-cloud-functions/protos/google/cloud/functions/v2beta/functions.proto create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json create mode 100644 packages/google-cloud-functions/src/v2alpha/function_service_client.ts create mode 100644 packages/google-cloud-functions/src/v2alpha/function_service_client_config.json create mode 100644 packages/google-cloud-functions/src/v2alpha/function_service_proto_list.json create mode 100644 packages/google-cloud-functions/src/v2alpha/gapic_metadata.json create mode 100644 packages/google-cloud-functions/src/v2alpha/index.ts create mode 100644 packages/google-cloud-functions/src/v2beta/function_service_client.ts create mode 100644 packages/google-cloud-functions/src/v2beta/function_service_client_config.json create mode 100644 packages/google-cloud-functions/src/v2beta/function_service_proto_list.json create mode 100644 packages/google-cloud-functions/src/v2beta/gapic_metadata.json create mode 100644 packages/google-cloud-functions/src/v2beta/index.ts create mode 100644 packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts create mode 100644 packages/google-cloud-functions/test/gapic_function_service_v2beta.ts diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v2alpha/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v2alpha/functions.proto new file mode 100644 index 00000000000..6bc9de6832c --- /dev/null +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v2alpha/functions.proto @@ -0,0 +1,1033 @@ +// 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.cloud.functions.v2alpha; + +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/any.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v2alpha;functions"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v2alpha"; +option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/locations/{location}/builds/{build}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" +}; +option (google.api.resource_definition) = { + type: "vpcaccess.googleapis.com/Connector" + pattern: "projects/{project}/locations/{location}/connectors/{connector}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Channel" + pattern: "projects/{project}/locations/{location}/channels/{channel}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Google Cloud Functions is used to deploy functions that are executed by +// Google in response to various events. Data connected with that event is +// passed to a function as the input data. +// +// A **function** is a resource which describes a function that should be +// executed and how it is triggered. +service FunctionService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (Function) { + option (google.api.http) = { + get: "/v2alpha/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*}/functions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "parent,function,function_id"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2alpha.Function" + metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2alpha/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2alpha.Function" + metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2alpha/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.functions.v2alpha.OperationMetadata" + }; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making a HTTP PUT request, these two headers need to be specified: + // + // * `content-type: application/zip` + // + // And this header SHOULD NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v2alpha/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and should be used within + // 30 minutes of generation. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v2alpha/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Returns a list of runtimes that are supported for the requested project. + rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { + option (google.api.http) = { + get: "/v2alpha/{parent=projects/*/locations/*}/runtimes" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The environment the function is hosted on. +enum Environment { + // Unspecified + ENVIRONMENT_UNSPECIFIED = 0; + + // Gen 1 + GEN_1 = 1; + + // Gen 2 + GEN_2 = 2; +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulates function and trigger configurations. +message Function { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/Function" + pattern: "projects/{project}/locations/{location}/functions/{function}" + plural: "functions" + singular: "function" + }; + + // Describes the current state of the function. + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function is not serving. + FAILED = 2; + + // Function is being created or updated. + DEPLOYING = 3; + + // Function is being deleted. + DELETING = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // Describe whether the function is gen1 or gen2. + Environment environment = 10; + + // User-provided description of a function. + string description = 2; + + // Describes the Build step of the function that builds a container from the + // given source. + BuildConfig build_config = 3; + + // Describes the Service being deployed. Currently deploys services to Cloud + // Run (fully managed). + ServiceConfig service_config = 4; + + // An Eventarc trigger managed by Google Cloud Functions that fires events in + // response to a condition in another service. + EventTrigger event_trigger = 5; + + // Output only. State of the function. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 8; + + // Output only. State Messages for this Cloud Function. + repeated StateMessage state_messages = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Informational messages about the state of the Cloud Function or Operation. +message StateMessage { + // Severity of the state message. + enum Severity { + // Not specified. Invalid severity. + SEVERITY_UNSPECIFIED = 0; + + // ERROR-level severity. + ERROR = 1; + + // WARNING-level severity. + WARNING = 2; + + // INFO-level severity. + INFO = 3; + } + + // Severity of the state message. + Severity severity = 1; + + // One-word CamelCase type of the state message. + string type = 2; + + // The message. + string message = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // A revision within the Cloud Source Repository must be specified in + // one of these ways. + oneof revision { + // Regex matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch_name = 3; + + // Regex matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } + + // ID of the project that owns the Cloud Source Repository. If omitted, the + // project ID requesting the build is assumed. + string project_id = 1; + + // Name of the Cloud Source Repository. + string repo_name = 2; + + // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's `dir` is specified and is an + // absolute path, this value is ignored for that step's execution. + // eg. helloworld (no leading slash allowed) + string dir = 6; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 7; +} + +// The location of the function source code. +message Source { + // Location of the source. + // At least one source needs to be provided for the deployment to succeed. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 1; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 2; + } +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's `source.storage_source`, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 1; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 2; +} + +// Describes the Build step of the function that builds a container from the +// given source. +message BuildConfig { + // Output only. The Cloud Build name of the latest successful deployment of the + // function. + string build = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + } + ]; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 2; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 3; + + // The location of the function source code. + Source source = 4; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // {project} and {region} are the project id and region respectively where the + // worker pool is defined and {workerPool} is the short name of the worker + // pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role Cloud Build Custom Workers Builder + // (roles/cloudbuild.customworkers.builder) in the project. + string worker_pool = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // User-provided build-time environment variables for the function + map environment_variables = 6; + + // Optional. User managed repository created in Artifact Registry optionally with a + // customer managed encryption key. This is the repository to which the + // function docker image will be pushed after it is built by Cloud Build. + // If unspecified, GCF will create and use a repository named 'gcf-artifacts' + // for every deployed region. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 7 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + } + ]; +} + +// Describes the Service being deployed. +// Currently Supported : Cloud Run (fully managed). +message ServiceConfig { + // Available egress settings. + // + // This controls what traffic is diverted through the VPC Access Connector + // resource. By default PRIVATE_RANGES_ONLY will be used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the VPC Access Connector only for private IP space from RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of VPC Access Connector for all egress traffic from the + // function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL will be used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // Output only. Name of the service associated with a Function. + // The format of this field is + // `projects/{project}/locations/{region}/services/{service}` + string service = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "run.googleapis.com/Service" + } + ]; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + int32 timeout_seconds = 2; + + // The amount of memory available for a function. + // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + // supplied the value is interpreted as bytes. + // See + // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + // a full description. + string available_memory = 13; + + // Environment variables that shall be available during function execution. + map environment_variables = 4; + + // The limit on the maximum number of function instances that may coexist at a + // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions may, for a + // short period of time, create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you may want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. + int32 max_instance_count = 5; + + // The limit on the minimum number of function instances that may coexist at a + // given time. + // + // Function instances are kept in idle state for a short period after they + // finished executing the request to reduce cold start time for subsequent + // requests. Setting a minimum instance count will ensure that the given + // number of instances are kept running in idle state always. This can help + // with cold start times when jump in incoming request count occurs after the + // idle instance would have been stopped in the default case. + int32 min_instance_count = 12; + + // The Serverless VPC Access connector that this cloud function can connect + // to. The format of this field is `projects/*/locations/*/connectors/*`. + string vpc_connector = 6 [(google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + }]; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 8; + + // Output only. URI of the Service deployed. + string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The email of the service's service account. If empty, defaults to + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 10; + + // Whether 100% of traffic is routed to the latest revision. + // On CreateFunction and UpdateFunction, when set to true, the revision being + // deployed will serve 100% of traffic, ignoring any traffic split settings, + // if any. On GetFunction, true will be returned if the latest revision is + // serving 100% of traffic. + bool all_traffic_on_latest_revision = 16; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 17; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 19; + + // Output only. The name of service revision. + string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from secret manager and expose it as an +// environment variable. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferably project number but can also be the + // project ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new instances + // start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from secret manager and make it available as files mounted +// at the requested paths within the application container. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version will be fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `secret_foo` would mount the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` would mount the secret value files + // under the `/etc/secrets` directory. This directory will also be completely + // shadowed and unavailable to mount any other secrets. + // Recommended mount path: /etc/secrets + string mount_path = 1; + + // Project identifier (preferably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret will be made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + +// Describes EventTrigger, used to request events to be sent from another +// service. +message EventTrigger { + // Describes the retry policy in case of function's execution failure. + // Retried execution is charged as any other execution. + enum RetryPolicy { + // Not specified. + RETRY_POLICY_UNSPECIFIED = 0; + + // Do not retry. + RETRY_POLICY_DO_NOT_RETRY = 1; + + // Retry on any failure, retry up to 7 days with an exponential backoff + // (capped at 10 seconds). + RETRY_POLICY_RETRY = 2; + } + + // Output only. The resource name of the Eventarc trigger. The format of this field is + // `projects/{project}/locations/{region}/triggers/{trigger}`. + string trigger = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The region that the trigger will be in. The trigger will only receive + // events originating in this region. It can be the same + // region as the function, a different region or multi-region, or the global + // region. If not provided, defaults to the same region as the function. + string trigger_region = 2; + + // Required. The type of event to observe. For example: + // `google.cloud.audit.log.v1.written` or + // `google.cloud.pubsub.topic.v1.messagePublished`. + string event_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Criteria used to filter events. + repeated EventFilter event_filters = 4; + + // Optional. The name of a Pub/Sub topic in the same project that will be used + // as the transport topic for the event delivery. Format: + // `projects/{project}/topics/{topic}`. + // + // This is only valid for events of type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + // will not be deleted at function deletion. + string pubsub_topic = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + } + ]; + + // Optional. The email of the trigger's service account. The service account must have + // permission to invoke Cloud Run services, the permission is + // `run.routes.invoke`. + // If empty, defaults to the Compute Engine default service account: + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If unset, then defaults to ignoring failures (i.e. not retrying them). + RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // Required. The project and location from which the function should be listed, + // specified in the format `projects/*/locations/*` + // If you want to list functions in all locations, use "-" in place of a + // location. When listing functions in all locations, if one or more + // location(s) are unreachable, the response will contain functions from all + // reachable locations along with the names of any unreachable locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudfunctions.googleapis.com/Function" + } + ]; + + // Maximum number of functions to return per call. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; + + // The filter for Functions that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 4; + + // The sorting order of the resources returned. Value should be a comma + // separated list of fields. The default sorting oder is ascending. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated Function functions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, specified + // in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + Function function = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for the function, which will become the final component of + // the function's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string function_id = 3; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + Function function = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If no field mask is provided, all provided fields in the request will be + // updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // Required. The project and location in which the Google Cloud Storage signed URL + // should be generated, specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; + + // The location of the source code in the upload bucket. + // + // Once the archive is uploaded using the `upload_url` use this field to + // set the `function.build_config.source.storage_source` + // during CreateFunction and UpdateFunction. + // + // Generation defaults to 0, as Cloud Storage provides a new generation only + // upon uploading a new object or version of an object. + StorageSource storage_source = 2; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // Required. The name of function for which source code Google Cloud Storage signed + // URL should be generated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} + +// Request for the `ListRuntimes` method. +message ListRuntimesRequest { + // Required. The project and location from which the runtimes should be listed, + // specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The filter for Runtimes that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 2; +} + +// Response for the `ListRuntimes` method. +message ListRuntimesResponse { + // Describes a runtime and any special information (e.g., deprecation status) + // related to it. + message Runtime { + // The name of the runtime, e.g., 'go113', 'nodejs12', etc. + string name = 1; + + // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + string display_name = 5; + + // The stage of life this runtime is in, e.g., BETA, GA, etc. + RuntimeStage stage = 2; + + // Warning messages, e.g., a deprecation warning. + repeated string warnings = 3; + + // The environment for the runtime. + Environment environment = 4; + } + + // The various stages that a runtime can be in. + enum RuntimeStage { + // Not specified. + RUNTIME_STAGE_UNSPECIFIED = 0; + + // The runtime is in development. + DEVELOPMENT = 1; + + // The runtime is in the Alpha stage. + ALPHA = 2; + + // The runtime is in the Beta stage. + BETA = 3; + + // The runtime is generally available. + GA = 4; + + // The runtime is deprecated. + DEPRECATED = 5; + + // The runtime is no longer supported. + DECOMMISSIONED = 6; + } + + // The runtimes that match the request. + repeated Runtime runtimes = 1; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6; + + // API version used to start the operation. + string api_version = 7; + + // The original request that started the operation. + google.protobuf.Any request_resource = 8; + + // Mechanism for reporting in-progress stages + repeated Stage stages = 9; +} + +// Each Stage of the deployment process +message Stage { + // Possible names for a Stage + enum Name { + // Not specified. Invalid name. + NAME_UNSPECIFIED = 0; + + // Artifact Regsitry Stage + ARTIFACT_REGISTRY = 1; + + // Build Stage + BUILD = 2; + + // Service Stage + SERVICE = 3; + + // Trigger Stage + TRIGGER = 4; + + // Service Rollback Stage + SERVICE_ROLLBACK = 5; + + // Trigger Rollback Stage + TRIGGER_ROLLBACK = 6; + } + + // Possible states for a Stage + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Stage has not started. + NOT_STARTED = 1; + + // Stage is in progress. + IN_PROGRESS = 2; + + // Stage has completed. + COMPLETE = 3; + } + + // Name of the Stage. This will be unique for each Stage. + Name name = 1; + + // Message describing the Stage + string message = 2; + + // Current state of the Stage + State state = 3; + + // Resource of the Stage + string resource = 4; + + // Link to the current Stage resource + string resource_uri = 5; + + // State messages from the current Stage. + repeated StateMessage state_messages = 6; +} diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v2beta/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v2beta/functions.proto new file mode 100644 index 00000000000..4d8ee95f343 --- /dev/null +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v2beta/functions.proto @@ -0,0 +1,1033 @@ +// 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.cloud.functions.v2beta; + +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/any.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v2beta;functions"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v2beta"; +option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/locations/{location}/builds/{build}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" +}; +option (google.api.resource_definition) = { + type: "vpcaccess.googleapis.com/Connector" + pattern: "projects/{project}/locations/{location}/connectors/{connector}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Channel" + pattern: "projects/{project}/locations/{location}/channels/{channel}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Google Cloud Functions is used to deploy functions that are executed by +// Google in response to various events. Data connected with that event is +// passed to a function as the input data. +// +// A **function** is a resource which describes a function that should be +// executed and how it is triggered. +service FunctionService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (Function) { + option (google.api.http) = { + get: "/v2beta/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*}/functions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "parent,function,function_id"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2beta.Function" + metadata_type: "google.cloud.functions.v2beta.OperationMetadata" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2beta/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2beta.Function" + metadata_type: "google.cloud.functions.v2beta.OperationMetadata" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2beta/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.functions.v2beta.OperationMetadata" + }; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making a HTTP PUT request, these two headers need to be specified: + // + // * `content-type: application/zip` + // + // And this header SHOULD NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v2beta/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and should be used within + // 30 minutes of generation. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v2beta/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Returns a list of runtimes that are supported for the requested project. + rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { + option (google.api.http) = { + get: "/v2beta/{parent=projects/*/locations/*}/runtimes" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The environment the function is hosted on. +enum Environment { + // Unspecified + ENVIRONMENT_UNSPECIFIED = 0; + + // Gen 1 + GEN_1 = 1; + + // Gen 2 + GEN_2 = 2; +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulates function and trigger configurations. +message Function { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/Function" + pattern: "projects/{project}/locations/{location}/functions/{function}" + plural: "functions" + singular: "function" + }; + + // Describes the current state of the function. + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function is not serving. + FAILED = 2; + + // Function is being created or updated. + DEPLOYING = 3; + + // Function is being deleted. + DELETING = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // Describe whether the function is gen1 or gen2. + Environment environment = 10; + + // User-provided description of a function. + string description = 2; + + // Describes the Build step of the function that builds a container from the + // given source. + BuildConfig build_config = 3; + + // Describes the Service being deployed. Currently deploys services to Cloud + // Run (fully managed). + ServiceConfig service_config = 4; + + // An Eventarc trigger managed by Google Cloud Functions that fires events in + // response to a condition in another service. + EventTrigger event_trigger = 5; + + // Output only. State of the function. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 8; + + // Output only. State Messages for this Cloud Function. + repeated StateMessage state_messages = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Informational messages about the state of the Cloud Function or Operation. +message StateMessage { + // Severity of the state message. + enum Severity { + // Not specified. Invalid severity. + SEVERITY_UNSPECIFIED = 0; + + // ERROR-level severity. + ERROR = 1; + + // WARNING-level severity. + WARNING = 2; + + // INFO-level severity. + INFO = 3; + } + + // Severity of the state message. + Severity severity = 1; + + // One-word CamelCase type of the state message. + string type = 2; + + // The message. + string message = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // A revision within the Cloud Source Repository must be specified in + // one of these ways. + oneof revision { + // Regex matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch_name = 3; + + // Regex matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } + + // ID of the project that owns the Cloud Source Repository. If omitted, the + // project ID requesting the build is assumed. + string project_id = 1; + + // Name of the Cloud Source Repository. + string repo_name = 2; + + // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's `dir` is specified and is an + // absolute path, this value is ignored for that step's execution. + // eg. helloworld (no leading slash allowed) + string dir = 6; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 7; +} + +// The location of the function source code. +message Source { + // Location of the source. + // At least one source needs to be provided for the deployment to succeed. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 1; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 2; + } +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's `source.storage_source`, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 1; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 2; +} + +// Describes the Build step of the function that builds a container from the +// given source. +message BuildConfig { + // Output only. The Cloud Build name of the latest successful deployment of the + // function. + string build = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + } + ]; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 2; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 3; + + // The location of the function source code. + Source source = 4; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // {project} and {region} are the project id and region respectively where the + // worker pool is defined and {workerPool} is the short name of the worker + // pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role Cloud Build Custom Workers Builder + // (roles/cloudbuild.customworkers.builder) in the project. + string worker_pool = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // User-provided build-time environment variables for the function + map environment_variables = 6; + + // Optional. User managed repository created in Artifact Registry optionally with a + // customer managed encryption key. This is the repository to which the + // function docker image will be pushed after it is built by Cloud Build. + // If unspecified, GCF will create and use a repository named 'gcf-artifacts' + // for every deployed region. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 7 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + } + ]; +} + +// Describes the Service being deployed. +// Currently Supported : Cloud Run (fully managed). +message ServiceConfig { + // Available egress settings. + // + // This controls what traffic is diverted through the VPC Access Connector + // resource. By default PRIVATE_RANGES_ONLY will be used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the VPC Access Connector only for private IP space from RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of VPC Access Connector for all egress traffic from the + // function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL will be used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // Output only. Name of the service associated with a Function. + // The format of this field is + // `projects/{project}/locations/{region}/services/{service}` + string service = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "run.googleapis.com/Service" + } + ]; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + int32 timeout_seconds = 2; + + // The amount of memory available for a function. + // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + // supplied the value is interpreted as bytes. + // See + // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + // a full description. + string available_memory = 13; + + // Environment variables that shall be available during function execution. + map environment_variables = 4; + + // The limit on the maximum number of function instances that may coexist at a + // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions may, for a + // short period of time, create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you may want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. + int32 max_instance_count = 5; + + // The limit on the minimum number of function instances that may coexist at a + // given time. + // + // Function instances are kept in idle state for a short period after they + // finished executing the request to reduce cold start time for subsequent + // requests. Setting a minimum instance count will ensure that the given + // number of instances are kept running in idle state always. This can help + // with cold start times when jump in incoming request count occurs after the + // idle instance would have been stopped in the default case. + int32 min_instance_count = 12; + + // The Serverless VPC Access connector that this cloud function can connect + // to. The format of this field is `projects/*/locations/*/connectors/*`. + string vpc_connector = 6 [(google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + }]; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 8; + + // Output only. URI of the Service deployed. + string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The email of the service's service account. If empty, defaults to + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 10; + + // Whether 100% of traffic is routed to the latest revision. + // On CreateFunction and UpdateFunction, when set to true, the revision being + // deployed will serve 100% of traffic, ignoring any traffic split settings, + // if any. On GetFunction, true will be returned if the latest revision is + // serving 100% of traffic. + bool all_traffic_on_latest_revision = 16; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 17; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 19; + + // Output only. The name of service revision. + string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from secret manager and expose it as an +// environment variable. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferably project number but can also be the + // project ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new instances + // start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from secret manager and make it available as files mounted +// at the requested paths within the application container. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version will be fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `secret_foo` would mount the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` would mount the secret value files + // under the `/etc/secrets` directory. This directory will also be completely + // shadowed and unavailable to mount any other secrets. + // Recommended mount path: /etc/secrets + string mount_path = 1; + + // Project identifier (preferably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret will be made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + +// Describes EventTrigger, used to request events to be sent from another +// service. +message EventTrigger { + // Describes the retry policy in case of function's execution failure. + // Retried execution is charged as any other execution. + enum RetryPolicy { + // Not specified. + RETRY_POLICY_UNSPECIFIED = 0; + + // Do not retry. + RETRY_POLICY_DO_NOT_RETRY = 1; + + // Retry on any failure, retry up to 7 days with an exponential backoff + // (capped at 10 seconds). + RETRY_POLICY_RETRY = 2; + } + + // Output only. The resource name of the Eventarc trigger. The format of this field is + // `projects/{project}/locations/{region}/triggers/{trigger}`. + string trigger = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The region that the trigger will be in. The trigger will only receive + // events originating in this region. It can be the same + // region as the function, a different region or multi-region, or the global + // region. If not provided, defaults to the same region as the function. + string trigger_region = 2; + + // Required. The type of event to observe. For example: + // `google.cloud.audit.log.v1.written` or + // `google.cloud.pubsub.topic.v1.messagePublished`. + string event_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Criteria used to filter events. + repeated EventFilter event_filters = 4; + + // Optional. The name of a Pub/Sub topic in the same project that will be used + // as the transport topic for the event delivery. Format: + // `projects/{project}/topics/{topic}`. + // + // This is only valid for events of type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + // will not be deleted at function deletion. + string pubsub_topic = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + } + ]; + + // Optional. The email of the trigger's service account. The service account must have + // permission to invoke Cloud Run services, the permission is + // `run.routes.invoke`. + // If empty, defaults to the Compute Engine default service account: + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If unset, then defaults to ignoring failures (i.e. not retrying them). + RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // Required. The project and location from which the function should be listed, + // specified in the format `projects/*/locations/*` + // If you want to list functions in all locations, use "-" in place of a + // location. When listing functions in all locations, if one or more + // location(s) are unreachable, the response will contain functions from all + // reachable locations along with the names of any unreachable locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudfunctions.googleapis.com/Function" + } + ]; + + // Maximum number of functions to return per call. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; + + // The filter for Functions that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 4; + + // The sorting order of the resources returned. Value should be a comma + // separated list of fields. The default sorting oder is ascending. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated Function functions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, specified + // in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + Function function = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for the function, which will become the final component of + // the function's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string function_id = 3; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + Function function = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If no field mask is provided, all provided fields in the request will be + // updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // Required. The project and location in which the Google Cloud Storage signed URL + // should be generated, specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; + + // The location of the source code in the upload bucket. + // + // Once the archive is uploaded using the `upload_url` use this field to + // set the `function.build_config.source.storage_source` + // during CreateFunction and UpdateFunction. + // + // Generation defaults to 0, as Cloud Storage provides a new generation only + // upon uploading a new object or version of an object. + StorageSource storage_source = 2; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // Required. The name of function for which source code Google Cloud Storage signed + // URL should be generated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} + +// Request for the `ListRuntimes` method. +message ListRuntimesRequest { + // Required. The project and location from which the runtimes should be listed, + // specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The filter for Runtimes that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 2; +} + +// Response for the `ListRuntimes` method. +message ListRuntimesResponse { + // Describes a runtime and any special information (e.g., deprecation status) + // related to it. + message Runtime { + // The name of the runtime, e.g., 'go113', 'nodejs12', etc. + string name = 1; + + // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + string display_name = 5; + + // The stage of life this runtime is in, e.g., BETA, GA, etc. + RuntimeStage stage = 2; + + // Warning messages, e.g., a deprecation warning. + repeated string warnings = 3; + + // The environment for the runtime. + Environment environment = 4; + } + + // The various stages that a runtime can be in. + enum RuntimeStage { + // Not specified. + RUNTIME_STAGE_UNSPECIFIED = 0; + + // The runtime is in development. + DEVELOPMENT = 1; + + // The runtime is in the Alpha stage. + ALPHA = 2; + + // The runtime is in the Beta stage. + BETA = 3; + + // The runtime is generally available. + GA = 4; + + // The runtime is deprecated. + DEPRECATED = 5; + + // The runtime is no longer supported. + DECOMMISSIONED = 6; + } + + // The runtimes that match the request. + repeated Runtime runtimes = 1; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6; + + // API version used to start the operation. + string api_version = 7; + + // The original request that started the operation. + google.protobuf.Any request_resource = 8; + + // Mechanism for reporting in-progress stages + repeated Stage stages = 9; +} + +// Each Stage of the deployment process +message Stage { + // Possible names for a Stage + enum Name { + // Not specified. Invalid name. + NAME_UNSPECIFIED = 0; + + // Artifact Regsitry Stage + ARTIFACT_REGISTRY = 1; + + // Build Stage + BUILD = 2; + + // Service Stage + SERVICE = 3; + + // Trigger Stage + TRIGGER = 4; + + // Service Rollback Stage + SERVICE_ROLLBACK = 5; + + // Trigger Rollback Stage + TRIGGER_ROLLBACK = 6; + } + + // Possible states for a Stage + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Stage has not started. + NOT_STARTED = 1; + + // Stage is in progress. + IN_PROGRESS = 2; + + // Stage has completed. + COMPLETE = 3; + } + + // Name of the Stage. This will be unique for each Stage. + Name name = 1; + + // Message describing the Stage + string message = 2; + + // Current state of the Stage + State state = 3; + + // Resource of the Stage + string resource = 4; + + // Link to the current Stage resource + string resource_uri = 5; + + // State messages from the current Stage. + repeated StateMessage state_messages = 6; +} diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index a915969ca4d..e2e45ccb285 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -2695,6 +2695,6678 @@ export namespace google { public toJSON(): { [k: string]: any }; } } + + /** Namespace v2alpha. */ + namespace v2alpha { + + /** Represents a FunctionService */ + class FunctionService extends $protobuf.rpc.Service { + + /** + * Constructs a new FunctionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new FunctionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): FunctionService; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Function + */ + public getFunction(request: google.cloud.functions.v2alpha.IGetFunctionRequest, callback: google.cloud.functions.v2alpha.FunctionService.GetFunctionCallback): void; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @returns Promise + */ + public getFunction(request: google.cloud.functions.v2alpha.IGetFunctionRequest): Promise; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListFunctionsResponse + */ + public listFunctions(request: google.cloud.functions.v2alpha.IListFunctionsRequest, callback: google.cloud.functions.v2alpha.FunctionService.ListFunctionsCallback): void; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @returns Promise + */ + public listFunctions(request: google.cloud.functions.v2alpha.IListFunctionsRequest): Promise; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createFunction(request: google.cloud.functions.v2alpha.ICreateFunctionRequest, callback: google.cloud.functions.v2alpha.FunctionService.CreateFunctionCallback): void; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @returns Promise + */ + public createFunction(request: google.cloud.functions.v2alpha.ICreateFunctionRequest): Promise; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateFunction(request: google.cloud.functions.v2alpha.IUpdateFunctionRequest, callback: google.cloud.functions.v2alpha.FunctionService.UpdateFunctionCallback): void; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @returns Promise + */ + public updateFunction(request: google.cloud.functions.v2alpha.IUpdateFunctionRequest): Promise; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteFunction(request: google.cloud.functions.v2alpha.IDeleteFunctionRequest, callback: google.cloud.functions.v2alpha.FunctionService.DeleteFunctionCallback): void; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @returns Promise + */ + public deleteFunction(request: google.cloud.functions.v2alpha.IDeleteFunctionRequest): Promise; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + */ + public generateUploadUrl(request: google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, callback: google.cloud.functions.v2alpha.FunctionService.GenerateUploadUrlCallback): void; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @returns Promise + */ + public generateUploadUrl(request: google.cloud.functions.v2alpha.IGenerateUploadUrlRequest): Promise; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + */ + public generateDownloadUrl(request: google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, callback: google.cloud.functions.v2alpha.FunctionService.GenerateDownloadUrlCallback): void; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @returns Promise + */ + public generateDownloadUrl(request: google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest): Promise; + + /** + * Calls ListRuntimes. + * @param request ListRuntimesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRuntimesResponse + */ + public listRuntimes(request: google.cloud.functions.v2alpha.IListRuntimesRequest, callback: google.cloud.functions.v2alpha.FunctionService.ListRuntimesCallback): void; + + /** + * Calls ListRuntimes. + * @param request ListRuntimesRequest message or plain object + * @returns Promise + */ + public listRuntimes(request: google.cloud.functions.v2alpha.IListRuntimesRequest): Promise; + } + + namespace FunctionService { + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#getFunction}. + * @param error Error, if any + * @param [response] Function + */ + type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.Function) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#listFunctions}. + * @param error Error, if any + * @param [response] ListFunctionsResponse + */ + type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.ListFunctionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#createFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#updateFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#deleteFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#generateUploadUrl}. + * @param error Error, if any + * @param [response] GenerateUploadUrlResponse + */ + type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.GenerateUploadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#generateDownloadUrl}. + * @param error Error, if any + * @param [response] GenerateDownloadUrlResponse + */ + type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.GenerateDownloadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#listRuntimes}. + * @param error Error, if any + * @param [response] ListRuntimesResponse + */ + type ListRuntimesCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.ListRuntimesResponse) => void; + } + + /** Environment enum. */ + enum Environment { + ENVIRONMENT_UNSPECIFIED = 0, + GEN_1 = 1, + GEN_2 = 2 + } + + /** Properties of a Function. */ + interface IFunction { + + /** Function name */ + name?: (string|null); + + /** Function environment */ + environment?: (google.cloud.functions.v2alpha.Environment|keyof typeof google.cloud.functions.v2alpha.Environment|null); + + /** Function description */ + description?: (string|null); + + /** Function buildConfig */ + buildConfig?: (google.cloud.functions.v2alpha.IBuildConfig|null); + + /** Function serviceConfig */ + serviceConfig?: (google.cloud.functions.v2alpha.IServiceConfig|null); + + /** Function eventTrigger */ + eventTrigger?: (google.cloud.functions.v2alpha.IEventTrigger|null); + + /** Function state */ + state?: (google.cloud.functions.v2alpha.Function.State|keyof typeof google.cloud.functions.v2alpha.Function.State|null); + + /** Function updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Function labels */ + labels?: ({ [k: string]: string }|null); + + /** Function stateMessages */ + stateMessages?: (google.cloud.functions.v2alpha.IStateMessage[]|null); + } + + /** Represents a Function. */ + class Function implements IFunction { + + /** + * Constructs a new Function. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IFunction); + + /** Function name. */ + public name: string; + + /** Function environment. */ + public environment: (google.cloud.functions.v2alpha.Environment|keyof typeof google.cloud.functions.v2alpha.Environment); + + /** Function description. */ + public description: string; + + /** Function buildConfig. */ + public buildConfig?: (google.cloud.functions.v2alpha.IBuildConfig|null); + + /** Function serviceConfig. */ + public serviceConfig?: (google.cloud.functions.v2alpha.IServiceConfig|null); + + /** Function eventTrigger. */ + public eventTrigger?: (google.cloud.functions.v2alpha.IEventTrigger|null); + + /** Function state. */ + public state: (google.cloud.functions.v2alpha.Function.State|keyof typeof google.cloud.functions.v2alpha.Function.State); + + /** Function updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Function labels. */ + public labels: { [k: string]: string }; + + /** Function stateMessages. */ + public stateMessages: google.cloud.functions.v2alpha.IStateMessage[]; + + /** + * Creates a new Function instance using the specified properties. + * @param [properties] Properties to set + * @returns Function instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IFunction): google.cloud.functions.v2alpha.Function; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.cloud.functions.v2alpha.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Function message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.Function; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.Function; + + /** + * Verifies a Function message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Function + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.Function; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @param message Function + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.Function, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Function to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Function { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACTIVE = 1, + FAILED = 2, + DEPLOYING = 3, + DELETING = 4, + UNKNOWN = 5 + } + } + + /** Properties of a StateMessage. */ + interface IStateMessage { + + /** StateMessage severity */ + severity?: (google.cloud.functions.v2alpha.StateMessage.Severity|keyof typeof google.cloud.functions.v2alpha.StateMessage.Severity|null); + + /** StateMessage type */ + type?: (string|null); + + /** StateMessage message */ + message?: (string|null); + } + + /** Represents a StateMessage. */ + class StateMessage implements IStateMessage { + + /** + * Constructs a new StateMessage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IStateMessage); + + /** StateMessage severity. */ + public severity: (google.cloud.functions.v2alpha.StateMessage.Severity|keyof typeof google.cloud.functions.v2alpha.StateMessage.Severity); + + /** StateMessage type. */ + public type: string; + + /** StateMessage message. */ + public message: string; + + /** + * Creates a new StateMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns StateMessage instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IStateMessage): google.cloud.functions.v2alpha.StateMessage; + + /** + * Encodes the specified StateMessage message. Does not implicitly {@link google.cloud.functions.v2alpha.StateMessage.verify|verify} messages. + * @param message StateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IStateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StateMessage message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.StateMessage.verify|verify} messages. + * @param message StateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IStateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StateMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.StateMessage; + + /** + * Decodes a StateMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.StateMessage; + + /** + * Verifies a StateMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StateMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StateMessage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.StateMessage; + + /** + * Creates a plain object from a StateMessage message. Also converts values to other types if specified. + * @param message StateMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.StateMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StateMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace StateMessage { + + /** Severity enum. */ + enum Severity { + SEVERITY_UNSPECIFIED = 0, + ERROR = 1, + WARNING = 2, + INFO = 3 + } + } + + /** Properties of a StorageSource. */ + interface IStorageSource { + + /** StorageSource bucket */ + bucket?: (string|null); + + /** StorageSource object */ + object?: (string|null); + + /** StorageSource generation */ + generation?: (number|Long|string|null); + } + + /** Represents a StorageSource. */ + class StorageSource implements IStorageSource { + + /** + * Constructs a new StorageSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IStorageSource); + + /** StorageSource bucket. */ + public bucket: string; + + /** StorageSource object. */ + public object: string; + + /** StorageSource generation. */ + public generation: (number|Long|string); + + /** + * Creates a new StorageSource instance using the specified properties. + * @param [properties] Properties to set + * @returns StorageSource instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IStorageSource): google.cloud.functions.v2alpha.StorageSource; + + /** + * Encodes the specified StorageSource message. Does not implicitly {@link google.cloud.functions.v2alpha.StorageSource.verify|verify} messages. + * @param message StorageSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IStorageSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StorageSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.StorageSource.verify|verify} messages. + * @param message StorageSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IStorageSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StorageSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.StorageSource; + + /** + * Decodes a StorageSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.StorageSource; + + /** + * Verifies a StorageSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StorageSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StorageSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.StorageSource; + + /** + * Creates a plain object from a StorageSource message. Also converts values to other types if specified. + * @param message StorageSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.StorageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StorageSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RepoSource. */ + interface IRepoSource { + + /** RepoSource branchName */ + branchName?: (string|null); + + /** RepoSource tagName */ + tagName?: (string|null); + + /** RepoSource commitSha */ + commitSha?: (string|null); + + /** RepoSource projectId */ + projectId?: (string|null); + + /** RepoSource repoName */ + repoName?: (string|null); + + /** RepoSource dir */ + dir?: (string|null); + + /** RepoSource invertRegex */ + invertRegex?: (boolean|null); + } + + /** Represents a RepoSource. */ + class RepoSource implements IRepoSource { + + /** + * Constructs a new RepoSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IRepoSource); + + /** RepoSource branchName. */ + public branchName?: (string|null); + + /** RepoSource tagName. */ + public tagName?: (string|null); + + /** RepoSource commitSha. */ + public commitSha?: (string|null); + + /** RepoSource projectId. */ + public projectId: string; + + /** RepoSource repoName. */ + public repoName: string; + + /** RepoSource dir. */ + public dir: string; + + /** RepoSource invertRegex. */ + public invertRegex: boolean; + + /** RepoSource revision. */ + public revision?: ("branchName"|"tagName"|"commitSha"); + + /** + * Creates a new RepoSource instance using the specified properties. + * @param [properties] Properties to set + * @returns RepoSource instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IRepoSource): google.cloud.functions.v2alpha.RepoSource; + + /** + * Encodes the specified RepoSource message. Does not implicitly {@link google.cloud.functions.v2alpha.RepoSource.verify|verify} messages. + * @param message RepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RepoSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.RepoSource.verify|verify} messages. + * @param message RepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RepoSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.RepoSource; + + /** + * Decodes a RepoSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.RepoSource; + + /** + * Verifies a RepoSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RepoSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RepoSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.RepoSource; + + /** + * Creates a plain object from a RepoSource message. Also converts values to other types if specified. + * @param message RepoSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.RepoSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RepoSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Source. */ + interface ISource { + + /** Source storageSource */ + storageSource?: (google.cloud.functions.v2alpha.IStorageSource|null); + + /** Source repoSource */ + repoSource?: (google.cloud.functions.v2alpha.IRepoSource|null); + } + + /** Represents a Source. */ + class Source implements ISource { + + /** + * Constructs a new Source. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.ISource); + + /** Source storageSource. */ + public storageSource?: (google.cloud.functions.v2alpha.IStorageSource|null); + + /** Source repoSource. */ + public repoSource?: (google.cloud.functions.v2alpha.IRepoSource|null); + + /** Source source. */ + public source?: ("storageSource"|"repoSource"); + + /** + * Creates a new Source instance using the specified properties. + * @param [properties] Properties to set + * @returns Source instance + */ + public static create(properties?: google.cloud.functions.v2alpha.ISource): google.cloud.functions.v2alpha.Source; + + /** + * Encodes the specified Source message. Does not implicitly {@link google.cloud.functions.v2alpha.Source.verify|verify} messages. + * @param message Source message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.ISource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Source message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.Source.verify|verify} messages. + * @param message Source message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.ISource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Source message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.Source; + + /** + * Decodes a Source message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.Source; + + /** + * Verifies a Source message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Source message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Source + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.Source; + + /** + * Creates a plain object from a Source message. Also converts values to other types if specified. + * @param message Source + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.Source, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Source to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SourceProvenance. */ + interface ISourceProvenance { + + /** SourceProvenance resolvedStorageSource */ + resolvedStorageSource?: (google.cloud.functions.v2alpha.IStorageSource|null); + + /** SourceProvenance resolvedRepoSource */ + resolvedRepoSource?: (google.cloud.functions.v2alpha.IRepoSource|null); + } + + /** Represents a SourceProvenance. */ + class SourceProvenance implements ISourceProvenance { + + /** + * Constructs a new SourceProvenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.ISourceProvenance); + + /** SourceProvenance resolvedStorageSource. */ + public resolvedStorageSource?: (google.cloud.functions.v2alpha.IStorageSource|null); + + /** SourceProvenance resolvedRepoSource. */ + public resolvedRepoSource?: (google.cloud.functions.v2alpha.IRepoSource|null); + + /** + * Creates a new SourceProvenance instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceProvenance instance + */ + public static create(properties?: google.cloud.functions.v2alpha.ISourceProvenance): google.cloud.functions.v2alpha.SourceProvenance; + + /** + * Encodes the specified SourceProvenance message. Does not implicitly {@link google.cloud.functions.v2alpha.SourceProvenance.verify|verify} messages. + * @param message SourceProvenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.ISourceProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceProvenance message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.SourceProvenance.verify|verify} messages. + * @param message SourceProvenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.ISourceProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.SourceProvenance; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.SourceProvenance; + + /** + * Verifies a SourceProvenance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceProvenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceProvenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.SourceProvenance; + + /** + * Creates a plain object from a SourceProvenance message. Also converts values to other types if specified. + * @param message SourceProvenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.SourceProvenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceProvenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BuildConfig. */ + interface IBuildConfig { + + /** BuildConfig build */ + build?: (string|null); + + /** BuildConfig runtime */ + runtime?: (string|null); + + /** BuildConfig entryPoint */ + entryPoint?: (string|null); + + /** BuildConfig source */ + source?: (google.cloud.functions.v2alpha.ISource|null); + + /** BuildConfig sourceProvenance */ + sourceProvenance?: (google.cloud.functions.v2alpha.ISourceProvenance|null); + + /** BuildConfig workerPool */ + workerPool?: (string|null); + + /** BuildConfig environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** BuildConfig dockerRepository */ + dockerRepository?: (string|null); + } + + /** Represents a BuildConfig. */ + class BuildConfig implements IBuildConfig { + + /** + * Constructs a new BuildConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IBuildConfig); + + /** BuildConfig build. */ + public build: string; + + /** BuildConfig runtime. */ + public runtime: string; + + /** BuildConfig entryPoint. */ + public entryPoint: string; + + /** BuildConfig source. */ + public source?: (google.cloud.functions.v2alpha.ISource|null); + + /** BuildConfig sourceProvenance. */ + public sourceProvenance?: (google.cloud.functions.v2alpha.ISourceProvenance|null); + + /** BuildConfig workerPool. */ + public workerPool: string; + + /** BuildConfig environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** BuildConfig dockerRepository. */ + public dockerRepository: string; + + /** + * Creates a new BuildConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BuildConfig instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IBuildConfig): google.cloud.functions.v2alpha.BuildConfig; + + /** + * Encodes the specified BuildConfig message. Does not implicitly {@link google.cloud.functions.v2alpha.BuildConfig.verify|verify} messages. + * @param message BuildConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IBuildConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BuildConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.BuildConfig.verify|verify} messages. + * @param message BuildConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IBuildConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BuildConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.BuildConfig; + + /** + * Decodes a BuildConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.BuildConfig; + + /** + * Verifies a BuildConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BuildConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BuildConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.BuildConfig; + + /** + * Creates a plain object from a BuildConfig message. Also converts values to other types if specified. + * @param message BuildConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.BuildConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BuildConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceConfig. */ + interface IServiceConfig { + + /** ServiceConfig service */ + service?: (string|null); + + /** ServiceConfig timeoutSeconds */ + timeoutSeconds?: (number|null); + + /** ServiceConfig availableMemory */ + availableMemory?: (string|null); + + /** ServiceConfig environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** ServiceConfig maxInstanceCount */ + maxInstanceCount?: (number|null); + + /** ServiceConfig minInstanceCount */ + minInstanceCount?: (number|null); + + /** ServiceConfig vpcConnector */ + vpcConnector?: (string|null); + + /** ServiceConfig vpcConnectorEgressSettings */ + vpcConnectorEgressSettings?: (google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings|null); + + /** ServiceConfig ingressSettings */ + ingressSettings?: (google.cloud.functions.v2alpha.ServiceConfig.IngressSettings|keyof typeof google.cloud.functions.v2alpha.ServiceConfig.IngressSettings|null); + + /** ServiceConfig uri */ + uri?: (string|null); + + /** ServiceConfig serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** ServiceConfig allTrafficOnLatestRevision */ + allTrafficOnLatestRevision?: (boolean|null); + + /** ServiceConfig secretEnvironmentVariables */ + secretEnvironmentVariables?: (google.cloud.functions.v2alpha.ISecretEnvVar[]|null); + + /** ServiceConfig secretVolumes */ + secretVolumes?: (google.cloud.functions.v2alpha.ISecretVolume[]|null); + + /** ServiceConfig revision */ + revision?: (string|null); + } + + /** Represents a ServiceConfig. */ + class ServiceConfig implements IServiceConfig { + + /** + * Constructs a new ServiceConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IServiceConfig); + + /** ServiceConfig service. */ + public service: string; + + /** ServiceConfig timeoutSeconds. */ + public timeoutSeconds: number; + + /** ServiceConfig availableMemory. */ + public availableMemory: string; + + /** ServiceConfig environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** ServiceConfig maxInstanceCount. */ + public maxInstanceCount: number; + + /** ServiceConfig minInstanceCount. */ + public minInstanceCount: number; + + /** ServiceConfig vpcConnector. */ + public vpcConnector: string; + + /** ServiceConfig vpcConnectorEgressSettings. */ + public vpcConnectorEgressSettings: (google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings); + + /** ServiceConfig ingressSettings. */ + public ingressSettings: (google.cloud.functions.v2alpha.ServiceConfig.IngressSettings|keyof typeof google.cloud.functions.v2alpha.ServiceConfig.IngressSettings); + + /** ServiceConfig uri. */ + public uri: string; + + /** ServiceConfig serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** ServiceConfig allTrafficOnLatestRevision. */ + public allTrafficOnLatestRevision: boolean; + + /** ServiceConfig secretEnvironmentVariables. */ + public secretEnvironmentVariables: google.cloud.functions.v2alpha.ISecretEnvVar[]; + + /** ServiceConfig secretVolumes. */ + public secretVolumes: google.cloud.functions.v2alpha.ISecretVolume[]; + + /** ServiceConfig revision. */ + public revision: string; + + /** + * Creates a new ServiceConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceConfig instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IServiceConfig): google.cloud.functions.v2alpha.ServiceConfig; + + /** + * Encodes the specified ServiceConfig message. Does not implicitly {@link google.cloud.functions.v2alpha.ServiceConfig.verify|verify} messages. + * @param message ServiceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IServiceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ServiceConfig.verify|verify} messages. + * @param message ServiceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IServiceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.ServiceConfig; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.ServiceConfig; + + /** + * Verifies a ServiceConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.ServiceConfig; + + /** + * Creates a plain object from a ServiceConfig message. Also converts values to other types if specified. + * @param message ServiceConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.ServiceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ServiceConfig { + + /** VpcConnectorEgressSettings enum. */ + enum VpcConnectorEgressSettings { + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0, + PRIVATE_RANGES_ONLY = 1, + ALL_TRAFFIC = 2 + } + + /** IngressSettings enum. */ + enum IngressSettings { + INGRESS_SETTINGS_UNSPECIFIED = 0, + ALLOW_ALL = 1, + ALLOW_INTERNAL_ONLY = 2, + ALLOW_INTERNAL_AND_GCLB = 3 + } + } + + /** Properties of a SecretEnvVar. */ + interface ISecretEnvVar { + + /** SecretEnvVar key */ + key?: (string|null); + + /** SecretEnvVar projectId */ + projectId?: (string|null); + + /** SecretEnvVar secret */ + secret?: (string|null); + + /** SecretEnvVar version */ + version?: (string|null); + } + + /** Represents a SecretEnvVar. */ + class SecretEnvVar implements ISecretEnvVar { + + /** + * Constructs a new SecretEnvVar. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.ISecretEnvVar); + + /** SecretEnvVar key. */ + public key: string; + + /** SecretEnvVar projectId. */ + public projectId: string; + + /** SecretEnvVar secret. */ + public secret: string; + + /** SecretEnvVar version. */ + public version: string; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretEnvVar instance + */ + public static create(properties?: google.cloud.functions.v2alpha.ISecretEnvVar): google.cloud.functions.v2alpha.SecretEnvVar; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v2alpha.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.SecretEnvVar; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.SecretEnvVar; + + /** + * Verifies a SecretEnvVar message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretEnvVar + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.SecretEnvVar; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @param message SecretEnvVar + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.SecretEnvVar, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretEnvVar to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SecretVolume. */ + interface ISecretVolume { + + /** SecretVolume mountPath */ + mountPath?: (string|null); + + /** SecretVolume projectId */ + projectId?: (string|null); + + /** SecretVolume secret */ + secret?: (string|null); + + /** SecretVolume versions */ + versions?: (google.cloud.functions.v2alpha.SecretVolume.ISecretVersion[]|null); + } + + /** Represents a SecretVolume. */ + class SecretVolume implements ISecretVolume { + + /** + * Constructs a new SecretVolume. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.ISecretVolume); + + /** SecretVolume mountPath. */ + public mountPath: string; + + /** SecretVolume projectId. */ + public projectId: string; + + /** SecretVolume secret. */ + public secret: string; + + /** SecretVolume versions. */ + public versions: google.cloud.functions.v2alpha.SecretVolume.ISecretVersion[]; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVolume instance + */ + public static create(properties?: google.cloud.functions.v2alpha.ISecretVolume): google.cloud.functions.v2alpha.SecretVolume; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v2alpha.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.SecretVolume; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.SecretVolume; + + /** + * Verifies a SecretVolume message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVolume + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.SecretVolume; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @param message SecretVolume + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.SecretVolume, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVolume to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SecretVolume { + + /** Properties of a SecretVersion. */ + interface ISecretVersion { + + /** SecretVersion version */ + version?: (string|null); + + /** SecretVersion path */ + path?: (string|null); + } + + /** Represents a SecretVersion. */ + class SecretVersion implements ISecretVersion { + + /** + * Constructs a new SecretVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.SecretVolume.ISecretVersion); + + /** SecretVersion version. */ + public version: string; + + /** SecretVersion path. */ + public path: string; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVersion instance + */ + public static create(properties?: google.cloud.functions.v2alpha.SecretVolume.ISecretVersion): google.cloud.functions.v2alpha.SecretVolume.SecretVersion; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v2alpha.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.SecretVolume.SecretVersion; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.SecretVolume.SecretVersion; + + /** + * Verifies a SecretVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.SecretVolume.SecretVersion; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @param message SecretVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.SecretVolume.SecretVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EventTrigger. */ + interface IEventTrigger { + + /** EventTrigger trigger */ + trigger?: (string|null); + + /** EventTrigger triggerRegion */ + triggerRegion?: (string|null); + + /** EventTrigger eventType */ + eventType?: (string|null); + + /** EventTrigger eventFilters */ + eventFilters?: (google.cloud.functions.v2alpha.IEventFilter[]|null); + + /** EventTrigger pubsubTopic */ + pubsubTopic?: (string|null); + + /** EventTrigger serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** EventTrigger retryPolicy */ + retryPolicy?: (google.cloud.functions.v2alpha.EventTrigger.RetryPolicy|keyof typeof google.cloud.functions.v2alpha.EventTrigger.RetryPolicy|null); + + /** EventTrigger channel */ + channel?: (string|null); + } + + /** Represents an EventTrigger. */ + class EventTrigger implements IEventTrigger { + + /** + * Constructs a new EventTrigger. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IEventTrigger); + + /** EventTrigger trigger. */ + public trigger: string; + + /** EventTrigger triggerRegion. */ + public triggerRegion: string; + + /** EventTrigger eventType. */ + public eventType: string; + + /** EventTrigger eventFilters. */ + public eventFilters: google.cloud.functions.v2alpha.IEventFilter[]; + + /** EventTrigger pubsubTopic. */ + public pubsubTopic: string; + + /** EventTrigger serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** EventTrigger retryPolicy. */ + public retryPolicy: (google.cloud.functions.v2alpha.EventTrigger.RetryPolicy|keyof typeof google.cloud.functions.v2alpha.EventTrigger.RetryPolicy); + + /** EventTrigger channel. */ + public channel: string; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @param [properties] Properties to set + * @returns EventTrigger instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IEventTrigger): google.cloud.functions.v2alpha.EventTrigger; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v2alpha.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.EventTrigger; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.EventTrigger; + + /** + * Verifies an EventTrigger message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventTrigger + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.EventTrigger; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @param message EventTrigger + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.EventTrigger, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventTrigger to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EventTrigger { + + /** RetryPolicy enum. */ + enum RetryPolicy { + RETRY_POLICY_UNSPECIFIED = 0, + RETRY_POLICY_DO_NOT_RETRY = 1, + RETRY_POLICY_RETRY = 2 + } + } + + /** Properties of an EventFilter. */ + interface IEventFilter { + + /** EventFilter attribute */ + attribute?: (string|null); + + /** EventFilter value */ + value?: (string|null); + + /** EventFilter operator */ + operator?: (string|null); + } + + /** Represents an EventFilter. */ + class EventFilter implements IEventFilter { + + /** + * Constructs a new EventFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IEventFilter); + + /** EventFilter attribute. */ + public attribute: string; + + /** EventFilter value. */ + public value: string; + + /** EventFilter operator. */ + public operator: string; + + /** + * Creates a new EventFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns EventFilter instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IEventFilter): google.cloud.functions.v2alpha.EventFilter; + + /** + * Encodes the specified EventFilter message. Does not implicitly {@link google.cloud.functions.v2alpha.EventFilter.verify|verify} messages. + * @param message EventFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IEventFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventFilter message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.EventFilter.verify|verify} messages. + * @param message EventFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IEventFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.EventFilter; + + /** + * Decodes an EventFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.EventFilter; + + /** + * Verifies an EventFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EventFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventFilter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.EventFilter; + + /** + * Creates a plain object from an EventFilter message. Also converts values to other types if specified. + * @param message EventFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.EventFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetFunctionRequest. */ + interface IGetFunctionRequest { + + /** GetFunctionRequest name */ + name?: (string|null); + } + + /** Represents a GetFunctionRequest. */ + class GetFunctionRequest implements IGetFunctionRequest { + + /** + * Constructs a new GetFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IGetFunctionRequest); + + /** GetFunctionRequest name. */ + public name: string; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IGetFunctionRequest): google.cloud.functions.v2alpha.GetFunctionRequest; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.GetFunctionRequest; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.GetFunctionRequest; + + /** + * Verifies a GetFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.GetFunctionRequest; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @param message GetFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.GetFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsRequest. */ + interface IListFunctionsRequest { + + /** ListFunctionsRequest parent */ + parent?: (string|null); + + /** ListFunctionsRequest pageSize */ + pageSize?: (number|null); + + /** ListFunctionsRequest pageToken */ + pageToken?: (string|null); + + /** ListFunctionsRequest filter */ + filter?: (string|null); + + /** ListFunctionsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListFunctionsRequest. */ + class ListFunctionsRequest implements IListFunctionsRequest { + + /** + * Constructs a new ListFunctionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IListFunctionsRequest); + + /** ListFunctionsRequest parent. */ + public parent: string; + + /** ListFunctionsRequest pageSize. */ + public pageSize: number; + + /** ListFunctionsRequest pageToken. */ + public pageToken: string; + + /** ListFunctionsRequest filter. */ + public filter: string; + + /** ListFunctionsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsRequest instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IListFunctionsRequest): google.cloud.functions.v2alpha.ListFunctionsRequest; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.ListFunctionsRequest; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.ListFunctionsRequest; + + /** + * Verifies a ListFunctionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.ListFunctionsRequest; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @param message ListFunctionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.ListFunctionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsResponse. */ + interface IListFunctionsResponse { + + /** ListFunctionsResponse functions */ + functions?: (google.cloud.functions.v2alpha.IFunction[]|null); + + /** ListFunctionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListFunctionsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListFunctionsResponse. */ + class ListFunctionsResponse implements IListFunctionsResponse { + + /** + * Constructs a new ListFunctionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IListFunctionsResponse); + + /** ListFunctionsResponse functions. */ + public functions: google.cloud.functions.v2alpha.IFunction[]; + + /** ListFunctionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListFunctionsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsResponse instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IListFunctionsResponse): google.cloud.functions.v2alpha.ListFunctionsResponse; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v2alpha.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.ListFunctionsResponse; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.ListFunctionsResponse; + + /** + * Verifies a ListFunctionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.ListFunctionsResponse; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @param message ListFunctionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.ListFunctionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateFunctionRequest. */ + interface ICreateFunctionRequest { + + /** CreateFunctionRequest parent */ + parent?: (string|null); + + /** CreateFunctionRequest function */ + "function"?: (google.cloud.functions.v2alpha.IFunction|null); + + /** CreateFunctionRequest functionId */ + functionId?: (string|null); + } + + /** Represents a CreateFunctionRequest. */ + class CreateFunctionRequest implements ICreateFunctionRequest { + + /** + * Constructs a new CreateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.ICreateFunctionRequest); + + /** CreateFunctionRequest parent. */ + public parent: string; + + /** CreateFunctionRequest function. */ + public function?: (google.cloud.functions.v2alpha.IFunction|null); + + /** CreateFunctionRequest functionId. */ + public functionId: string; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2alpha.ICreateFunctionRequest): google.cloud.functions.v2alpha.CreateFunctionRequest; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.CreateFunctionRequest; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.CreateFunctionRequest; + + /** + * Verifies a CreateFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.CreateFunctionRequest; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @param message CreateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.CreateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateFunctionRequest. */ + interface IUpdateFunctionRequest { + + /** UpdateFunctionRequest function */ + "function"?: (google.cloud.functions.v2alpha.IFunction|null); + + /** UpdateFunctionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateFunctionRequest. */ + class UpdateFunctionRequest implements IUpdateFunctionRequest { + + /** + * Constructs a new UpdateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IUpdateFunctionRequest); + + /** UpdateFunctionRequest function. */ + public function?: (google.cloud.functions.v2alpha.IFunction|null); + + /** UpdateFunctionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IUpdateFunctionRequest): google.cloud.functions.v2alpha.UpdateFunctionRequest; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.UpdateFunctionRequest; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.UpdateFunctionRequest; + + /** + * Verifies an UpdateFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.UpdateFunctionRequest; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @param message UpdateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.UpdateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteFunctionRequest. */ + interface IDeleteFunctionRequest { + + /** DeleteFunctionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteFunctionRequest. */ + class DeleteFunctionRequest implements IDeleteFunctionRequest { + + /** + * Constructs a new DeleteFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IDeleteFunctionRequest); + + /** DeleteFunctionRequest name. */ + public name: string; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IDeleteFunctionRequest): google.cloud.functions.v2alpha.DeleteFunctionRequest; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.DeleteFunctionRequest; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.DeleteFunctionRequest; + + /** + * Verifies a DeleteFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.DeleteFunctionRequest; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @param message DeleteFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.DeleteFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlRequest. */ + interface IGenerateUploadUrlRequest { + + /** GenerateUploadUrlRequest parent */ + parent?: (string|null); + } + + /** Represents a GenerateUploadUrlRequest. */ + class GenerateUploadUrlRequest implements IGenerateUploadUrlRequest { + + /** + * Constructs a new GenerateUploadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IGenerateUploadUrlRequest); + + /** GenerateUploadUrlRequest parent. */ + public parent: string; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IGenerateUploadUrlRequest): google.cloud.functions.v2alpha.GenerateUploadUrlRequest; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.GenerateUploadUrlRequest; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.GenerateUploadUrlRequest; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.GenerateUploadUrlRequest; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateUploadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.GenerateUploadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlResponse. */ + interface IGenerateUploadUrlResponse { + + /** GenerateUploadUrlResponse uploadUrl */ + uploadUrl?: (string|null); + + /** GenerateUploadUrlResponse storageSource */ + storageSource?: (google.cloud.functions.v2alpha.IStorageSource|null); + } + + /** Represents a GenerateUploadUrlResponse. */ + class GenerateUploadUrlResponse implements IGenerateUploadUrlResponse { + + /** + * Constructs a new GenerateUploadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IGenerateUploadUrlResponse); + + /** GenerateUploadUrlResponse uploadUrl. */ + public uploadUrl: string; + + /** GenerateUploadUrlResponse storageSource. */ + public storageSource?: (google.cloud.functions.v2alpha.IStorageSource|null); + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IGenerateUploadUrlResponse): google.cloud.functions.v2alpha.GenerateUploadUrlResponse; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.GenerateUploadUrlResponse; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.GenerateUploadUrlResponse; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.GenerateUploadUrlResponse; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateUploadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.GenerateUploadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlRequest. */ + interface IGenerateDownloadUrlRequest { + + /** GenerateDownloadUrlRequest name */ + name?: (string|null); + } + + /** Represents a GenerateDownloadUrlRequest. */ + class GenerateDownloadUrlRequest implements IGenerateDownloadUrlRequest { + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest); + + /** GenerateDownloadUrlRequest name. */ + public name: string; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest): google.cloud.functions.v2alpha.GenerateDownloadUrlRequest; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.GenerateDownloadUrlRequest; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.GenerateDownloadUrlRequest; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.GenerateDownloadUrlRequest; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.GenerateDownloadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlResponse. */ + interface IGenerateDownloadUrlResponse { + + /** GenerateDownloadUrlResponse downloadUrl */ + downloadUrl?: (string|null); + } + + /** Represents a GenerateDownloadUrlResponse. */ + class GenerateDownloadUrlResponse implements IGenerateDownloadUrlResponse { + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse); + + /** GenerateDownloadUrlResponse downloadUrl. */ + public downloadUrl: string; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse): google.cloud.functions.v2alpha.GenerateDownloadUrlResponse; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.GenerateDownloadUrlResponse; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.GenerateDownloadUrlResponse; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.GenerateDownloadUrlResponse; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.GenerateDownloadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimesRequest. */ + interface IListRuntimesRequest { + + /** ListRuntimesRequest parent */ + parent?: (string|null); + + /** ListRuntimesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListRuntimesRequest. */ + class ListRuntimesRequest implements IListRuntimesRequest { + + /** + * Constructs a new ListRuntimesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IListRuntimesRequest); + + /** ListRuntimesRequest parent. */ + public parent: string; + + /** ListRuntimesRequest filter. */ + public filter: string; + + /** + * Creates a new ListRuntimesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimesRequest instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IListRuntimesRequest): google.cloud.functions.v2alpha.ListRuntimesRequest; + + /** + * Encodes the specified ListRuntimesRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesRequest.verify|verify} messages. + * @param message ListRuntimesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IListRuntimesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimesRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesRequest.verify|verify} messages. + * @param message ListRuntimesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IListRuntimesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.ListRuntimesRequest; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.ListRuntimesRequest; + + /** + * Verifies a ListRuntimesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRuntimesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.ListRuntimesRequest; + + /** + * Creates a plain object from a ListRuntimesRequest message. Also converts values to other types if specified. + * @param message ListRuntimesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.ListRuntimesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimesResponse. */ + interface IListRuntimesResponse { + + /** ListRuntimesResponse runtimes */ + runtimes?: (google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime[]|null); + } + + /** Represents a ListRuntimesResponse. */ + class ListRuntimesResponse implements IListRuntimesResponse { + + /** + * Constructs a new ListRuntimesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IListRuntimesResponse); + + /** ListRuntimesResponse runtimes. */ + public runtimes: google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime[]; + + /** + * Creates a new ListRuntimesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimesResponse instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IListRuntimesResponse): google.cloud.functions.v2alpha.ListRuntimesResponse; + + /** + * Encodes the specified ListRuntimesResponse message. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesResponse.verify|verify} messages. + * @param message ListRuntimesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IListRuntimesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimesResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesResponse.verify|verify} messages. + * @param message ListRuntimesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IListRuntimesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.ListRuntimesResponse; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.ListRuntimesResponse; + + /** + * Verifies a ListRuntimesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRuntimesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.ListRuntimesResponse; + + /** + * Creates a plain object from a ListRuntimesResponse message. Also converts values to other types if specified. + * @param message ListRuntimesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.ListRuntimesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ListRuntimesResponse { + + /** Properties of a Runtime. */ + interface IRuntime { + + /** Runtime name */ + name?: (string|null); + + /** Runtime displayName */ + displayName?: (string|null); + + /** Runtime stage */ + stage?: (google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage|keyof typeof google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage|null); + + /** Runtime warnings */ + warnings?: (string[]|null); + + /** Runtime environment */ + environment?: (google.cloud.functions.v2alpha.Environment|keyof typeof google.cloud.functions.v2alpha.Environment|null); + } + + /** Represents a Runtime. */ + class Runtime implements IRuntime { + + /** + * Constructs a new Runtime. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime); + + /** Runtime name. */ + public name: string; + + /** Runtime displayName. */ + public displayName: string; + + /** Runtime stage. */ + public stage: (google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage|keyof typeof google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage); + + /** Runtime warnings. */ + public warnings: string[]; + + /** Runtime environment. */ + public environment: (google.cloud.functions.v2alpha.Environment|keyof typeof google.cloud.functions.v2alpha.Environment); + + /** + * Creates a new Runtime instance using the specified properties. + * @param [properties] Properties to set + * @returns Runtime instance + */ + public static create(properties?: google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime): google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime; + + /** + * Encodes the specified Runtime message. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.verify|verify} messages. + * @param message Runtime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Runtime message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.verify|verify} messages. + * @param message Runtime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Runtime message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime; + + /** + * Decodes a Runtime message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime; + + /** + * Verifies a Runtime message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Runtime message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Runtime + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime; + + /** + * Creates a plain object from a Runtime message. Also converts values to other types if specified. + * @param message Runtime + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Runtime to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** RuntimeStage enum. */ + enum RuntimeStage { + RUNTIME_STAGE_UNSPECIFIED = 0, + DEVELOPMENT = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5, + DECOMMISSIONED = 6 + } + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target */ + target?: (string|null); + + /** OperationMetadata verb */ + verb?: (string|null); + + /** OperationMetadata statusDetail */ + statusDetail?: (string|null); + + /** OperationMetadata cancelRequested */ + cancelRequested?: (boolean|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); + + /** OperationMetadata requestResource */ + requestResource?: (google.protobuf.IAny|null); + + /** OperationMetadata stages */ + stages?: (google.cloud.functions.v2alpha.IStage[]|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IOperationMetadata); + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target. */ + public target: string; + + /** OperationMetadata verb. */ + public verb: string; + + /** OperationMetadata statusDetail. */ + public statusDetail: string; + + /** OperationMetadata cancelRequested. */ + public cancelRequested: boolean; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; + + /** OperationMetadata requestResource. */ + public requestResource?: (google.protobuf.IAny|null); + + /** OperationMetadata stages. */ + public stages: google.cloud.functions.v2alpha.IStage[]; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IOperationMetadata): google.cloud.functions.v2alpha.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.functions.v2alpha.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.OperationMetadata; + + /** + * Verifies an OperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Stage. */ + interface IStage { + + /** Stage name */ + name?: (google.cloud.functions.v2alpha.Stage.Name|keyof typeof google.cloud.functions.v2alpha.Stage.Name|null); + + /** Stage message */ + message?: (string|null); + + /** Stage state */ + state?: (google.cloud.functions.v2alpha.Stage.State|keyof typeof google.cloud.functions.v2alpha.Stage.State|null); + + /** Stage resource */ + resource?: (string|null); + + /** Stage resourceUri */ + resourceUri?: (string|null); + + /** Stage stateMessages */ + stateMessages?: (google.cloud.functions.v2alpha.IStateMessage[]|null); + } + + /** Represents a Stage. */ + class Stage implements IStage { + + /** + * Constructs a new Stage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2alpha.IStage); + + /** Stage name. */ + public name: (google.cloud.functions.v2alpha.Stage.Name|keyof typeof google.cloud.functions.v2alpha.Stage.Name); + + /** Stage message. */ + public message: string; + + /** Stage state. */ + public state: (google.cloud.functions.v2alpha.Stage.State|keyof typeof google.cloud.functions.v2alpha.Stage.State); + + /** Stage resource. */ + public resource: string; + + /** Stage resourceUri. */ + public resourceUri: string; + + /** Stage stateMessages. */ + public stateMessages: google.cloud.functions.v2alpha.IStateMessage[]; + + /** + * Creates a new Stage instance using the specified properties. + * @param [properties] Properties to set + * @returns Stage instance + */ + public static create(properties?: google.cloud.functions.v2alpha.IStage): google.cloud.functions.v2alpha.Stage; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.cloud.functions.v2alpha.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2alpha.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2alpha.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2alpha.Stage; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2alpha.Stage; + + /** + * Verifies a Stage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Stage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2alpha.Stage; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @param message Stage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2alpha.Stage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Stage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Stage { + + /** Name enum. */ + enum Name { + NAME_UNSPECIFIED = 0, + ARTIFACT_REGISTRY = 1, + BUILD = 2, + SERVICE = 3, + TRIGGER = 4, + SERVICE_ROLLBACK = 5, + TRIGGER_ROLLBACK = 6 + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + NOT_STARTED = 1, + IN_PROGRESS = 2, + COMPLETE = 3 + } + } + } + + /** Namespace v2beta. */ + namespace v2beta { + + /** Represents a FunctionService */ + class FunctionService extends $protobuf.rpc.Service { + + /** + * Constructs a new FunctionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new FunctionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): FunctionService; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Function + */ + public getFunction(request: google.cloud.functions.v2beta.IGetFunctionRequest, callback: google.cloud.functions.v2beta.FunctionService.GetFunctionCallback): void; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @returns Promise + */ + public getFunction(request: google.cloud.functions.v2beta.IGetFunctionRequest): Promise; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListFunctionsResponse + */ + public listFunctions(request: google.cloud.functions.v2beta.IListFunctionsRequest, callback: google.cloud.functions.v2beta.FunctionService.ListFunctionsCallback): void; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @returns Promise + */ + public listFunctions(request: google.cloud.functions.v2beta.IListFunctionsRequest): Promise; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createFunction(request: google.cloud.functions.v2beta.ICreateFunctionRequest, callback: google.cloud.functions.v2beta.FunctionService.CreateFunctionCallback): void; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @returns Promise + */ + public createFunction(request: google.cloud.functions.v2beta.ICreateFunctionRequest): Promise; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateFunction(request: google.cloud.functions.v2beta.IUpdateFunctionRequest, callback: google.cloud.functions.v2beta.FunctionService.UpdateFunctionCallback): void; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @returns Promise + */ + public updateFunction(request: google.cloud.functions.v2beta.IUpdateFunctionRequest): Promise; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteFunction(request: google.cloud.functions.v2beta.IDeleteFunctionRequest, callback: google.cloud.functions.v2beta.FunctionService.DeleteFunctionCallback): void; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @returns Promise + */ + public deleteFunction(request: google.cloud.functions.v2beta.IDeleteFunctionRequest): Promise; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + */ + public generateUploadUrl(request: google.cloud.functions.v2beta.IGenerateUploadUrlRequest, callback: google.cloud.functions.v2beta.FunctionService.GenerateUploadUrlCallback): void; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @returns Promise + */ + public generateUploadUrl(request: google.cloud.functions.v2beta.IGenerateUploadUrlRequest): Promise; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + */ + public generateDownloadUrl(request: google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, callback: google.cloud.functions.v2beta.FunctionService.GenerateDownloadUrlCallback): void; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @returns Promise + */ + public generateDownloadUrl(request: google.cloud.functions.v2beta.IGenerateDownloadUrlRequest): Promise; + + /** + * Calls ListRuntimes. + * @param request ListRuntimesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRuntimesResponse + */ + public listRuntimes(request: google.cloud.functions.v2beta.IListRuntimesRequest, callback: google.cloud.functions.v2beta.FunctionService.ListRuntimesCallback): void; + + /** + * Calls ListRuntimes. + * @param request ListRuntimesRequest message or plain object + * @returns Promise + */ + public listRuntimes(request: google.cloud.functions.v2beta.IListRuntimesRequest): Promise; + } + + namespace FunctionService { + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#getFunction}. + * @param error Error, if any + * @param [response] Function + */ + type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.Function) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#listFunctions}. + * @param error Error, if any + * @param [response] ListFunctionsResponse + */ + type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.ListFunctionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#createFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#updateFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#deleteFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#generateUploadUrl}. + * @param error Error, if any + * @param [response] GenerateUploadUrlResponse + */ + type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.GenerateUploadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#generateDownloadUrl}. + * @param error Error, if any + * @param [response] GenerateDownloadUrlResponse + */ + type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.GenerateDownloadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#listRuntimes}. + * @param error Error, if any + * @param [response] ListRuntimesResponse + */ + type ListRuntimesCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.ListRuntimesResponse) => void; + } + + /** Environment enum. */ + enum Environment { + ENVIRONMENT_UNSPECIFIED = 0, + GEN_1 = 1, + GEN_2 = 2 + } + + /** Properties of a Function. */ + interface IFunction { + + /** Function name */ + name?: (string|null); + + /** Function environment */ + environment?: (google.cloud.functions.v2beta.Environment|keyof typeof google.cloud.functions.v2beta.Environment|null); + + /** Function description */ + description?: (string|null); + + /** Function buildConfig */ + buildConfig?: (google.cloud.functions.v2beta.IBuildConfig|null); + + /** Function serviceConfig */ + serviceConfig?: (google.cloud.functions.v2beta.IServiceConfig|null); + + /** Function eventTrigger */ + eventTrigger?: (google.cloud.functions.v2beta.IEventTrigger|null); + + /** Function state */ + state?: (google.cloud.functions.v2beta.Function.State|keyof typeof google.cloud.functions.v2beta.Function.State|null); + + /** Function updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Function labels */ + labels?: ({ [k: string]: string }|null); + + /** Function stateMessages */ + stateMessages?: (google.cloud.functions.v2beta.IStateMessage[]|null); + } + + /** Represents a Function. */ + class Function implements IFunction { + + /** + * Constructs a new Function. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IFunction); + + /** Function name. */ + public name: string; + + /** Function environment. */ + public environment: (google.cloud.functions.v2beta.Environment|keyof typeof google.cloud.functions.v2beta.Environment); + + /** Function description. */ + public description: string; + + /** Function buildConfig. */ + public buildConfig?: (google.cloud.functions.v2beta.IBuildConfig|null); + + /** Function serviceConfig. */ + public serviceConfig?: (google.cloud.functions.v2beta.IServiceConfig|null); + + /** Function eventTrigger. */ + public eventTrigger?: (google.cloud.functions.v2beta.IEventTrigger|null); + + /** Function state. */ + public state: (google.cloud.functions.v2beta.Function.State|keyof typeof google.cloud.functions.v2beta.Function.State); + + /** Function updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Function labels. */ + public labels: { [k: string]: string }; + + /** Function stateMessages. */ + public stateMessages: google.cloud.functions.v2beta.IStateMessage[]; + + /** + * Creates a new Function instance using the specified properties. + * @param [properties] Properties to set + * @returns Function instance + */ + public static create(properties?: google.cloud.functions.v2beta.IFunction): google.cloud.functions.v2beta.Function; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.cloud.functions.v2beta.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Function message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.Function; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.Function; + + /** + * Verifies a Function message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Function + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.Function; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @param message Function + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.Function, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Function to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Function { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACTIVE = 1, + FAILED = 2, + DEPLOYING = 3, + DELETING = 4, + UNKNOWN = 5 + } + } + + /** Properties of a StateMessage. */ + interface IStateMessage { + + /** StateMessage severity */ + severity?: (google.cloud.functions.v2beta.StateMessage.Severity|keyof typeof google.cloud.functions.v2beta.StateMessage.Severity|null); + + /** StateMessage type */ + type?: (string|null); + + /** StateMessage message */ + message?: (string|null); + } + + /** Represents a StateMessage. */ + class StateMessage implements IStateMessage { + + /** + * Constructs a new StateMessage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IStateMessage); + + /** StateMessage severity. */ + public severity: (google.cloud.functions.v2beta.StateMessage.Severity|keyof typeof google.cloud.functions.v2beta.StateMessage.Severity); + + /** StateMessage type. */ + public type: string; + + /** StateMessage message. */ + public message: string; + + /** + * Creates a new StateMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns StateMessage instance + */ + public static create(properties?: google.cloud.functions.v2beta.IStateMessage): google.cloud.functions.v2beta.StateMessage; + + /** + * Encodes the specified StateMessage message. Does not implicitly {@link google.cloud.functions.v2beta.StateMessage.verify|verify} messages. + * @param message StateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IStateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StateMessage message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.StateMessage.verify|verify} messages. + * @param message StateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IStateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StateMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.StateMessage; + + /** + * Decodes a StateMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.StateMessage; + + /** + * Verifies a StateMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StateMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StateMessage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.StateMessage; + + /** + * Creates a plain object from a StateMessage message. Also converts values to other types if specified. + * @param message StateMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.StateMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StateMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace StateMessage { + + /** Severity enum. */ + enum Severity { + SEVERITY_UNSPECIFIED = 0, + ERROR = 1, + WARNING = 2, + INFO = 3 + } + } + + /** Properties of a StorageSource. */ + interface IStorageSource { + + /** StorageSource bucket */ + bucket?: (string|null); + + /** StorageSource object */ + object?: (string|null); + + /** StorageSource generation */ + generation?: (number|Long|string|null); + } + + /** Represents a StorageSource. */ + class StorageSource implements IStorageSource { + + /** + * Constructs a new StorageSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IStorageSource); + + /** StorageSource bucket. */ + public bucket: string; + + /** StorageSource object. */ + public object: string; + + /** StorageSource generation. */ + public generation: (number|Long|string); + + /** + * Creates a new StorageSource instance using the specified properties. + * @param [properties] Properties to set + * @returns StorageSource instance + */ + public static create(properties?: google.cloud.functions.v2beta.IStorageSource): google.cloud.functions.v2beta.StorageSource; + + /** + * Encodes the specified StorageSource message. Does not implicitly {@link google.cloud.functions.v2beta.StorageSource.verify|verify} messages. + * @param message StorageSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IStorageSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StorageSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.StorageSource.verify|verify} messages. + * @param message StorageSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IStorageSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StorageSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.StorageSource; + + /** + * Decodes a StorageSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.StorageSource; + + /** + * Verifies a StorageSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StorageSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StorageSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.StorageSource; + + /** + * Creates a plain object from a StorageSource message. Also converts values to other types if specified. + * @param message StorageSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.StorageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StorageSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RepoSource. */ + interface IRepoSource { + + /** RepoSource branchName */ + branchName?: (string|null); + + /** RepoSource tagName */ + tagName?: (string|null); + + /** RepoSource commitSha */ + commitSha?: (string|null); + + /** RepoSource projectId */ + projectId?: (string|null); + + /** RepoSource repoName */ + repoName?: (string|null); + + /** RepoSource dir */ + dir?: (string|null); + + /** RepoSource invertRegex */ + invertRegex?: (boolean|null); + } + + /** Represents a RepoSource. */ + class RepoSource implements IRepoSource { + + /** + * Constructs a new RepoSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IRepoSource); + + /** RepoSource branchName. */ + public branchName?: (string|null); + + /** RepoSource tagName. */ + public tagName?: (string|null); + + /** RepoSource commitSha. */ + public commitSha?: (string|null); + + /** RepoSource projectId. */ + public projectId: string; + + /** RepoSource repoName. */ + public repoName: string; + + /** RepoSource dir. */ + public dir: string; + + /** RepoSource invertRegex. */ + public invertRegex: boolean; + + /** RepoSource revision. */ + public revision?: ("branchName"|"tagName"|"commitSha"); + + /** + * Creates a new RepoSource instance using the specified properties. + * @param [properties] Properties to set + * @returns RepoSource instance + */ + public static create(properties?: google.cloud.functions.v2beta.IRepoSource): google.cloud.functions.v2beta.RepoSource; + + /** + * Encodes the specified RepoSource message. Does not implicitly {@link google.cloud.functions.v2beta.RepoSource.verify|verify} messages. + * @param message RepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RepoSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.RepoSource.verify|verify} messages. + * @param message RepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RepoSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.RepoSource; + + /** + * Decodes a RepoSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.RepoSource; + + /** + * Verifies a RepoSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RepoSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RepoSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.RepoSource; + + /** + * Creates a plain object from a RepoSource message. Also converts values to other types if specified. + * @param message RepoSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.RepoSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RepoSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Source. */ + interface ISource { + + /** Source storageSource */ + storageSource?: (google.cloud.functions.v2beta.IStorageSource|null); + + /** Source repoSource */ + repoSource?: (google.cloud.functions.v2beta.IRepoSource|null); + } + + /** Represents a Source. */ + class Source implements ISource { + + /** + * Constructs a new Source. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.ISource); + + /** Source storageSource. */ + public storageSource?: (google.cloud.functions.v2beta.IStorageSource|null); + + /** Source repoSource. */ + public repoSource?: (google.cloud.functions.v2beta.IRepoSource|null); + + /** Source source. */ + public source?: ("storageSource"|"repoSource"); + + /** + * Creates a new Source instance using the specified properties. + * @param [properties] Properties to set + * @returns Source instance + */ + public static create(properties?: google.cloud.functions.v2beta.ISource): google.cloud.functions.v2beta.Source; + + /** + * Encodes the specified Source message. Does not implicitly {@link google.cloud.functions.v2beta.Source.verify|verify} messages. + * @param message Source message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.ISource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Source message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.Source.verify|verify} messages. + * @param message Source message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.ISource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Source message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.Source; + + /** + * Decodes a Source message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.Source; + + /** + * Verifies a Source message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Source message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Source + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.Source; + + /** + * Creates a plain object from a Source message. Also converts values to other types if specified. + * @param message Source + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.Source, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Source to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SourceProvenance. */ + interface ISourceProvenance { + + /** SourceProvenance resolvedStorageSource */ + resolvedStorageSource?: (google.cloud.functions.v2beta.IStorageSource|null); + + /** SourceProvenance resolvedRepoSource */ + resolvedRepoSource?: (google.cloud.functions.v2beta.IRepoSource|null); + } + + /** Represents a SourceProvenance. */ + class SourceProvenance implements ISourceProvenance { + + /** + * Constructs a new SourceProvenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.ISourceProvenance); + + /** SourceProvenance resolvedStorageSource. */ + public resolvedStorageSource?: (google.cloud.functions.v2beta.IStorageSource|null); + + /** SourceProvenance resolvedRepoSource. */ + public resolvedRepoSource?: (google.cloud.functions.v2beta.IRepoSource|null); + + /** + * Creates a new SourceProvenance instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceProvenance instance + */ + public static create(properties?: google.cloud.functions.v2beta.ISourceProvenance): google.cloud.functions.v2beta.SourceProvenance; + + /** + * Encodes the specified SourceProvenance message. Does not implicitly {@link google.cloud.functions.v2beta.SourceProvenance.verify|verify} messages. + * @param message SourceProvenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.ISourceProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceProvenance message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.SourceProvenance.verify|verify} messages. + * @param message SourceProvenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.ISourceProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.SourceProvenance; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.SourceProvenance; + + /** + * Verifies a SourceProvenance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceProvenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceProvenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.SourceProvenance; + + /** + * Creates a plain object from a SourceProvenance message. Also converts values to other types if specified. + * @param message SourceProvenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.SourceProvenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceProvenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BuildConfig. */ + interface IBuildConfig { + + /** BuildConfig build */ + build?: (string|null); + + /** BuildConfig runtime */ + runtime?: (string|null); + + /** BuildConfig entryPoint */ + entryPoint?: (string|null); + + /** BuildConfig source */ + source?: (google.cloud.functions.v2beta.ISource|null); + + /** BuildConfig sourceProvenance */ + sourceProvenance?: (google.cloud.functions.v2beta.ISourceProvenance|null); + + /** BuildConfig workerPool */ + workerPool?: (string|null); + + /** BuildConfig environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** BuildConfig dockerRepository */ + dockerRepository?: (string|null); + } + + /** Represents a BuildConfig. */ + class BuildConfig implements IBuildConfig { + + /** + * Constructs a new BuildConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IBuildConfig); + + /** BuildConfig build. */ + public build: string; + + /** BuildConfig runtime. */ + public runtime: string; + + /** BuildConfig entryPoint. */ + public entryPoint: string; + + /** BuildConfig source. */ + public source?: (google.cloud.functions.v2beta.ISource|null); + + /** BuildConfig sourceProvenance. */ + public sourceProvenance?: (google.cloud.functions.v2beta.ISourceProvenance|null); + + /** BuildConfig workerPool. */ + public workerPool: string; + + /** BuildConfig environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** BuildConfig dockerRepository. */ + public dockerRepository: string; + + /** + * Creates a new BuildConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BuildConfig instance + */ + public static create(properties?: google.cloud.functions.v2beta.IBuildConfig): google.cloud.functions.v2beta.BuildConfig; + + /** + * Encodes the specified BuildConfig message. Does not implicitly {@link google.cloud.functions.v2beta.BuildConfig.verify|verify} messages. + * @param message BuildConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IBuildConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BuildConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.BuildConfig.verify|verify} messages. + * @param message BuildConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IBuildConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BuildConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.BuildConfig; + + /** + * Decodes a BuildConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.BuildConfig; + + /** + * Verifies a BuildConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BuildConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BuildConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.BuildConfig; + + /** + * Creates a plain object from a BuildConfig message. Also converts values to other types if specified. + * @param message BuildConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.BuildConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BuildConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceConfig. */ + interface IServiceConfig { + + /** ServiceConfig service */ + service?: (string|null); + + /** ServiceConfig timeoutSeconds */ + timeoutSeconds?: (number|null); + + /** ServiceConfig availableMemory */ + availableMemory?: (string|null); + + /** ServiceConfig environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** ServiceConfig maxInstanceCount */ + maxInstanceCount?: (number|null); + + /** ServiceConfig minInstanceCount */ + minInstanceCount?: (number|null); + + /** ServiceConfig vpcConnector */ + vpcConnector?: (string|null); + + /** ServiceConfig vpcConnectorEgressSettings */ + vpcConnectorEgressSettings?: (google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings|null); + + /** ServiceConfig ingressSettings */ + ingressSettings?: (google.cloud.functions.v2beta.ServiceConfig.IngressSettings|keyof typeof google.cloud.functions.v2beta.ServiceConfig.IngressSettings|null); + + /** ServiceConfig uri */ + uri?: (string|null); + + /** ServiceConfig serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** ServiceConfig allTrafficOnLatestRevision */ + allTrafficOnLatestRevision?: (boolean|null); + + /** ServiceConfig secretEnvironmentVariables */ + secretEnvironmentVariables?: (google.cloud.functions.v2beta.ISecretEnvVar[]|null); + + /** ServiceConfig secretVolumes */ + secretVolumes?: (google.cloud.functions.v2beta.ISecretVolume[]|null); + + /** ServiceConfig revision */ + revision?: (string|null); + } + + /** Represents a ServiceConfig. */ + class ServiceConfig implements IServiceConfig { + + /** + * Constructs a new ServiceConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IServiceConfig); + + /** ServiceConfig service. */ + public service: string; + + /** ServiceConfig timeoutSeconds. */ + public timeoutSeconds: number; + + /** ServiceConfig availableMemory. */ + public availableMemory: string; + + /** ServiceConfig environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** ServiceConfig maxInstanceCount. */ + public maxInstanceCount: number; + + /** ServiceConfig minInstanceCount. */ + public minInstanceCount: number; + + /** ServiceConfig vpcConnector. */ + public vpcConnector: string; + + /** ServiceConfig vpcConnectorEgressSettings. */ + public vpcConnectorEgressSettings: (google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings); + + /** ServiceConfig ingressSettings. */ + public ingressSettings: (google.cloud.functions.v2beta.ServiceConfig.IngressSettings|keyof typeof google.cloud.functions.v2beta.ServiceConfig.IngressSettings); + + /** ServiceConfig uri. */ + public uri: string; + + /** ServiceConfig serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** ServiceConfig allTrafficOnLatestRevision. */ + public allTrafficOnLatestRevision: boolean; + + /** ServiceConfig secretEnvironmentVariables. */ + public secretEnvironmentVariables: google.cloud.functions.v2beta.ISecretEnvVar[]; + + /** ServiceConfig secretVolumes. */ + public secretVolumes: google.cloud.functions.v2beta.ISecretVolume[]; + + /** ServiceConfig revision. */ + public revision: string; + + /** + * Creates a new ServiceConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceConfig instance + */ + public static create(properties?: google.cloud.functions.v2beta.IServiceConfig): google.cloud.functions.v2beta.ServiceConfig; + + /** + * Encodes the specified ServiceConfig message. Does not implicitly {@link google.cloud.functions.v2beta.ServiceConfig.verify|verify} messages. + * @param message ServiceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IServiceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ServiceConfig.verify|verify} messages. + * @param message ServiceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IServiceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.ServiceConfig; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.ServiceConfig; + + /** + * Verifies a ServiceConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.ServiceConfig; + + /** + * Creates a plain object from a ServiceConfig message. Also converts values to other types if specified. + * @param message ServiceConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.ServiceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ServiceConfig { + + /** VpcConnectorEgressSettings enum. */ + enum VpcConnectorEgressSettings { + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0, + PRIVATE_RANGES_ONLY = 1, + ALL_TRAFFIC = 2 + } + + /** IngressSettings enum. */ + enum IngressSettings { + INGRESS_SETTINGS_UNSPECIFIED = 0, + ALLOW_ALL = 1, + ALLOW_INTERNAL_ONLY = 2, + ALLOW_INTERNAL_AND_GCLB = 3 + } + } + + /** Properties of a SecretEnvVar. */ + interface ISecretEnvVar { + + /** SecretEnvVar key */ + key?: (string|null); + + /** SecretEnvVar projectId */ + projectId?: (string|null); + + /** SecretEnvVar secret */ + secret?: (string|null); + + /** SecretEnvVar version */ + version?: (string|null); + } + + /** Represents a SecretEnvVar. */ + class SecretEnvVar implements ISecretEnvVar { + + /** + * Constructs a new SecretEnvVar. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.ISecretEnvVar); + + /** SecretEnvVar key. */ + public key: string; + + /** SecretEnvVar projectId. */ + public projectId: string; + + /** SecretEnvVar secret. */ + public secret: string; + + /** SecretEnvVar version. */ + public version: string; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretEnvVar instance + */ + public static create(properties?: google.cloud.functions.v2beta.ISecretEnvVar): google.cloud.functions.v2beta.SecretEnvVar; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v2beta.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.SecretEnvVar; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.SecretEnvVar; + + /** + * Verifies a SecretEnvVar message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretEnvVar + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.SecretEnvVar; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @param message SecretEnvVar + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.SecretEnvVar, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretEnvVar to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SecretVolume. */ + interface ISecretVolume { + + /** SecretVolume mountPath */ + mountPath?: (string|null); + + /** SecretVolume projectId */ + projectId?: (string|null); + + /** SecretVolume secret */ + secret?: (string|null); + + /** SecretVolume versions */ + versions?: (google.cloud.functions.v2beta.SecretVolume.ISecretVersion[]|null); + } + + /** Represents a SecretVolume. */ + class SecretVolume implements ISecretVolume { + + /** + * Constructs a new SecretVolume. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.ISecretVolume); + + /** SecretVolume mountPath. */ + public mountPath: string; + + /** SecretVolume projectId. */ + public projectId: string; + + /** SecretVolume secret. */ + public secret: string; + + /** SecretVolume versions. */ + public versions: google.cloud.functions.v2beta.SecretVolume.ISecretVersion[]; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVolume instance + */ + public static create(properties?: google.cloud.functions.v2beta.ISecretVolume): google.cloud.functions.v2beta.SecretVolume; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v2beta.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.SecretVolume; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.SecretVolume; + + /** + * Verifies a SecretVolume message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVolume + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.SecretVolume; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @param message SecretVolume + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.SecretVolume, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVolume to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SecretVolume { + + /** Properties of a SecretVersion. */ + interface ISecretVersion { + + /** SecretVersion version */ + version?: (string|null); + + /** SecretVersion path */ + path?: (string|null); + } + + /** Represents a SecretVersion. */ + class SecretVersion implements ISecretVersion { + + /** + * Constructs a new SecretVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.SecretVolume.ISecretVersion); + + /** SecretVersion version. */ + public version: string; + + /** SecretVersion path. */ + public path: string; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVersion instance + */ + public static create(properties?: google.cloud.functions.v2beta.SecretVolume.ISecretVersion): google.cloud.functions.v2beta.SecretVolume.SecretVersion; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v2beta.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.SecretVolume.SecretVersion; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.SecretVolume.SecretVersion; + + /** + * Verifies a SecretVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.SecretVolume.SecretVersion; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @param message SecretVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.SecretVolume.SecretVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EventTrigger. */ + interface IEventTrigger { + + /** EventTrigger trigger */ + trigger?: (string|null); + + /** EventTrigger triggerRegion */ + triggerRegion?: (string|null); + + /** EventTrigger eventType */ + eventType?: (string|null); + + /** EventTrigger eventFilters */ + eventFilters?: (google.cloud.functions.v2beta.IEventFilter[]|null); + + /** EventTrigger pubsubTopic */ + pubsubTopic?: (string|null); + + /** EventTrigger serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** EventTrigger retryPolicy */ + retryPolicy?: (google.cloud.functions.v2beta.EventTrigger.RetryPolicy|keyof typeof google.cloud.functions.v2beta.EventTrigger.RetryPolicy|null); + + /** EventTrigger channel */ + channel?: (string|null); + } + + /** Represents an EventTrigger. */ + class EventTrigger implements IEventTrigger { + + /** + * Constructs a new EventTrigger. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IEventTrigger); + + /** EventTrigger trigger. */ + public trigger: string; + + /** EventTrigger triggerRegion. */ + public triggerRegion: string; + + /** EventTrigger eventType. */ + public eventType: string; + + /** EventTrigger eventFilters. */ + public eventFilters: google.cloud.functions.v2beta.IEventFilter[]; + + /** EventTrigger pubsubTopic. */ + public pubsubTopic: string; + + /** EventTrigger serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** EventTrigger retryPolicy. */ + public retryPolicy: (google.cloud.functions.v2beta.EventTrigger.RetryPolicy|keyof typeof google.cloud.functions.v2beta.EventTrigger.RetryPolicy); + + /** EventTrigger channel. */ + public channel: string; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @param [properties] Properties to set + * @returns EventTrigger instance + */ + public static create(properties?: google.cloud.functions.v2beta.IEventTrigger): google.cloud.functions.v2beta.EventTrigger; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v2beta.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.EventTrigger; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.EventTrigger; + + /** + * Verifies an EventTrigger message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventTrigger + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.EventTrigger; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @param message EventTrigger + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.EventTrigger, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventTrigger to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EventTrigger { + + /** RetryPolicy enum. */ + enum RetryPolicy { + RETRY_POLICY_UNSPECIFIED = 0, + RETRY_POLICY_DO_NOT_RETRY = 1, + RETRY_POLICY_RETRY = 2 + } + } + + /** Properties of an EventFilter. */ + interface IEventFilter { + + /** EventFilter attribute */ + attribute?: (string|null); + + /** EventFilter value */ + value?: (string|null); + + /** EventFilter operator */ + operator?: (string|null); + } + + /** Represents an EventFilter. */ + class EventFilter implements IEventFilter { + + /** + * Constructs a new EventFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IEventFilter); + + /** EventFilter attribute. */ + public attribute: string; + + /** EventFilter value. */ + public value: string; + + /** EventFilter operator. */ + public operator: string; + + /** + * Creates a new EventFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns EventFilter instance + */ + public static create(properties?: google.cloud.functions.v2beta.IEventFilter): google.cloud.functions.v2beta.EventFilter; + + /** + * Encodes the specified EventFilter message. Does not implicitly {@link google.cloud.functions.v2beta.EventFilter.verify|verify} messages. + * @param message EventFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IEventFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventFilter message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.EventFilter.verify|verify} messages. + * @param message EventFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IEventFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.EventFilter; + + /** + * Decodes an EventFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.EventFilter; + + /** + * Verifies an EventFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EventFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventFilter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.EventFilter; + + /** + * Creates a plain object from an EventFilter message. Also converts values to other types if specified. + * @param message EventFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.EventFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetFunctionRequest. */ + interface IGetFunctionRequest { + + /** GetFunctionRequest name */ + name?: (string|null); + } + + /** Represents a GetFunctionRequest. */ + class GetFunctionRequest implements IGetFunctionRequest { + + /** + * Constructs a new GetFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IGetFunctionRequest); + + /** GetFunctionRequest name. */ + public name: string; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2beta.IGetFunctionRequest): google.cloud.functions.v2beta.GetFunctionRequest; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2beta.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.GetFunctionRequest; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.GetFunctionRequest; + + /** + * Verifies a GetFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.GetFunctionRequest; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @param message GetFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.GetFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsRequest. */ + interface IListFunctionsRequest { + + /** ListFunctionsRequest parent */ + parent?: (string|null); + + /** ListFunctionsRequest pageSize */ + pageSize?: (number|null); + + /** ListFunctionsRequest pageToken */ + pageToken?: (string|null); + + /** ListFunctionsRequest filter */ + filter?: (string|null); + + /** ListFunctionsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListFunctionsRequest. */ + class ListFunctionsRequest implements IListFunctionsRequest { + + /** + * Constructs a new ListFunctionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IListFunctionsRequest); + + /** ListFunctionsRequest parent. */ + public parent: string; + + /** ListFunctionsRequest pageSize. */ + public pageSize: number; + + /** ListFunctionsRequest pageToken. */ + public pageToken: string; + + /** ListFunctionsRequest filter. */ + public filter: string; + + /** ListFunctionsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsRequest instance + */ + public static create(properties?: google.cloud.functions.v2beta.IListFunctionsRequest): google.cloud.functions.v2beta.ListFunctionsRequest; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v2beta.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.ListFunctionsRequest; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.ListFunctionsRequest; + + /** + * Verifies a ListFunctionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.ListFunctionsRequest; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @param message ListFunctionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.ListFunctionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsResponse. */ + interface IListFunctionsResponse { + + /** ListFunctionsResponse functions */ + functions?: (google.cloud.functions.v2beta.IFunction[]|null); + + /** ListFunctionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListFunctionsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListFunctionsResponse. */ + class ListFunctionsResponse implements IListFunctionsResponse { + + /** + * Constructs a new ListFunctionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IListFunctionsResponse); + + /** ListFunctionsResponse functions. */ + public functions: google.cloud.functions.v2beta.IFunction[]; + + /** ListFunctionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListFunctionsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsResponse instance + */ + public static create(properties?: google.cloud.functions.v2beta.IListFunctionsResponse): google.cloud.functions.v2beta.ListFunctionsResponse; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v2beta.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.ListFunctionsResponse; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.ListFunctionsResponse; + + /** + * Verifies a ListFunctionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.ListFunctionsResponse; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @param message ListFunctionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.ListFunctionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateFunctionRequest. */ + interface ICreateFunctionRequest { + + /** CreateFunctionRequest parent */ + parent?: (string|null); + + /** CreateFunctionRequest function */ + "function"?: (google.cloud.functions.v2beta.IFunction|null); + + /** CreateFunctionRequest functionId */ + functionId?: (string|null); + } + + /** Represents a CreateFunctionRequest. */ + class CreateFunctionRequest implements ICreateFunctionRequest { + + /** + * Constructs a new CreateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.ICreateFunctionRequest); + + /** CreateFunctionRequest parent. */ + public parent: string; + + /** CreateFunctionRequest function. */ + public function?: (google.cloud.functions.v2beta.IFunction|null); + + /** CreateFunctionRequest functionId. */ + public functionId: string; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2beta.ICreateFunctionRequest): google.cloud.functions.v2beta.CreateFunctionRequest; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2beta.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.CreateFunctionRequest; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.CreateFunctionRequest; + + /** + * Verifies a CreateFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.CreateFunctionRequest; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @param message CreateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.CreateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateFunctionRequest. */ + interface IUpdateFunctionRequest { + + /** UpdateFunctionRequest function */ + "function"?: (google.cloud.functions.v2beta.IFunction|null); + + /** UpdateFunctionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateFunctionRequest. */ + class UpdateFunctionRequest implements IUpdateFunctionRequest { + + /** + * Constructs a new UpdateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IUpdateFunctionRequest); + + /** UpdateFunctionRequest function. */ + public function?: (google.cloud.functions.v2beta.IFunction|null); + + /** UpdateFunctionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2beta.IUpdateFunctionRequest): google.cloud.functions.v2beta.UpdateFunctionRequest; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2beta.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.UpdateFunctionRequest; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.UpdateFunctionRequest; + + /** + * Verifies an UpdateFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.UpdateFunctionRequest; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @param message UpdateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.UpdateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteFunctionRequest. */ + interface IDeleteFunctionRequest { + + /** DeleteFunctionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteFunctionRequest. */ + class DeleteFunctionRequest implements IDeleteFunctionRequest { + + /** + * Constructs a new DeleteFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IDeleteFunctionRequest); + + /** DeleteFunctionRequest name. */ + public name: string; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2beta.IDeleteFunctionRequest): google.cloud.functions.v2beta.DeleteFunctionRequest; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2beta.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.DeleteFunctionRequest; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.DeleteFunctionRequest; + + /** + * Verifies a DeleteFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.DeleteFunctionRequest; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @param message DeleteFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.DeleteFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlRequest. */ + interface IGenerateUploadUrlRequest { + + /** GenerateUploadUrlRequest parent */ + parent?: (string|null); + } + + /** Represents a GenerateUploadUrlRequest. */ + class GenerateUploadUrlRequest implements IGenerateUploadUrlRequest { + + /** + * Constructs a new GenerateUploadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IGenerateUploadUrlRequest); + + /** GenerateUploadUrlRequest parent. */ + public parent: string; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v2beta.IGenerateUploadUrlRequest): google.cloud.functions.v2beta.GenerateUploadUrlRequest; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2beta.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.GenerateUploadUrlRequest; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.GenerateUploadUrlRequest; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.GenerateUploadUrlRequest; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateUploadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.GenerateUploadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlResponse. */ + interface IGenerateUploadUrlResponse { + + /** GenerateUploadUrlResponse uploadUrl */ + uploadUrl?: (string|null); + + /** GenerateUploadUrlResponse storageSource */ + storageSource?: (google.cloud.functions.v2beta.IStorageSource|null); + } + + /** Represents a GenerateUploadUrlResponse. */ + class GenerateUploadUrlResponse implements IGenerateUploadUrlResponse { + + /** + * Constructs a new GenerateUploadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IGenerateUploadUrlResponse); + + /** GenerateUploadUrlResponse uploadUrl. */ + public uploadUrl: string; + + /** GenerateUploadUrlResponse storageSource. */ + public storageSource?: (google.cloud.functions.v2beta.IStorageSource|null); + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v2beta.IGenerateUploadUrlResponse): google.cloud.functions.v2beta.GenerateUploadUrlResponse; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2beta.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.GenerateUploadUrlResponse; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.GenerateUploadUrlResponse; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.GenerateUploadUrlResponse; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateUploadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.GenerateUploadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlRequest. */ + interface IGenerateDownloadUrlRequest { + + /** GenerateDownloadUrlRequest name */ + name?: (string|null); + } + + /** Represents a GenerateDownloadUrlRequest. */ + class GenerateDownloadUrlRequest implements IGenerateDownloadUrlRequest { + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IGenerateDownloadUrlRequest); + + /** GenerateDownloadUrlRequest name. */ + public name: string; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v2beta.IGenerateDownloadUrlRequest): google.cloud.functions.v2beta.GenerateDownloadUrlRequest; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2beta.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.GenerateDownloadUrlRequest; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.GenerateDownloadUrlRequest; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.GenerateDownloadUrlRequest; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.GenerateDownloadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlResponse. */ + interface IGenerateDownloadUrlResponse { + + /** GenerateDownloadUrlResponse downloadUrl */ + downloadUrl?: (string|null); + } + + /** Represents a GenerateDownloadUrlResponse. */ + class GenerateDownloadUrlResponse implements IGenerateDownloadUrlResponse { + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IGenerateDownloadUrlResponse); + + /** GenerateDownloadUrlResponse downloadUrl. */ + public downloadUrl: string; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v2beta.IGenerateDownloadUrlResponse): google.cloud.functions.v2beta.GenerateDownloadUrlResponse; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2beta.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.GenerateDownloadUrlResponse; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.GenerateDownloadUrlResponse; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.GenerateDownloadUrlResponse; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.GenerateDownloadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimesRequest. */ + interface IListRuntimesRequest { + + /** ListRuntimesRequest parent */ + parent?: (string|null); + + /** ListRuntimesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListRuntimesRequest. */ + class ListRuntimesRequest implements IListRuntimesRequest { + + /** + * Constructs a new ListRuntimesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IListRuntimesRequest); + + /** ListRuntimesRequest parent. */ + public parent: string; + + /** ListRuntimesRequest filter. */ + public filter: string; + + /** + * Creates a new ListRuntimesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimesRequest instance + */ + public static create(properties?: google.cloud.functions.v2beta.IListRuntimesRequest): google.cloud.functions.v2beta.ListRuntimesRequest; + + /** + * Encodes the specified ListRuntimesRequest message. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesRequest.verify|verify} messages. + * @param message ListRuntimesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IListRuntimesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimesRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesRequest.verify|verify} messages. + * @param message ListRuntimesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IListRuntimesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.ListRuntimesRequest; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.ListRuntimesRequest; + + /** + * Verifies a ListRuntimesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRuntimesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.ListRuntimesRequest; + + /** + * Creates a plain object from a ListRuntimesRequest message. Also converts values to other types if specified. + * @param message ListRuntimesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.ListRuntimesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimesResponse. */ + interface IListRuntimesResponse { + + /** ListRuntimesResponse runtimes */ + runtimes?: (google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime[]|null); + } + + /** Represents a ListRuntimesResponse. */ + class ListRuntimesResponse implements IListRuntimesResponse { + + /** + * Constructs a new ListRuntimesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IListRuntimesResponse); + + /** ListRuntimesResponse runtimes. */ + public runtimes: google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime[]; + + /** + * Creates a new ListRuntimesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimesResponse instance + */ + public static create(properties?: google.cloud.functions.v2beta.IListRuntimesResponse): google.cloud.functions.v2beta.ListRuntimesResponse; + + /** + * Encodes the specified ListRuntimesResponse message. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesResponse.verify|verify} messages. + * @param message ListRuntimesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IListRuntimesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimesResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesResponse.verify|verify} messages. + * @param message ListRuntimesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IListRuntimesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.ListRuntimesResponse; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.ListRuntimesResponse; + + /** + * Verifies a ListRuntimesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRuntimesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.ListRuntimesResponse; + + /** + * Creates a plain object from a ListRuntimesResponse message. Also converts values to other types if specified. + * @param message ListRuntimesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.ListRuntimesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ListRuntimesResponse { + + /** Properties of a Runtime. */ + interface IRuntime { + + /** Runtime name */ + name?: (string|null); + + /** Runtime displayName */ + displayName?: (string|null); + + /** Runtime stage */ + stage?: (google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage|keyof typeof google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage|null); + + /** Runtime warnings */ + warnings?: (string[]|null); + + /** Runtime environment */ + environment?: (google.cloud.functions.v2beta.Environment|keyof typeof google.cloud.functions.v2beta.Environment|null); + } + + /** Represents a Runtime. */ + class Runtime implements IRuntime { + + /** + * Constructs a new Runtime. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime); + + /** Runtime name. */ + public name: string; + + /** Runtime displayName. */ + public displayName: string; + + /** Runtime stage. */ + public stage: (google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage|keyof typeof google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage); + + /** Runtime warnings. */ + public warnings: string[]; + + /** Runtime environment. */ + public environment: (google.cloud.functions.v2beta.Environment|keyof typeof google.cloud.functions.v2beta.Environment); + + /** + * Creates a new Runtime instance using the specified properties. + * @param [properties] Properties to set + * @returns Runtime instance + */ + public static create(properties?: google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime): google.cloud.functions.v2beta.ListRuntimesResponse.Runtime; + + /** + * Encodes the specified Runtime message. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.verify|verify} messages. + * @param message Runtime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Runtime message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.verify|verify} messages. + * @param message Runtime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Runtime message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.ListRuntimesResponse.Runtime; + + /** + * Decodes a Runtime message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.ListRuntimesResponse.Runtime; + + /** + * Verifies a Runtime message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Runtime message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Runtime + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.ListRuntimesResponse.Runtime; + + /** + * Creates a plain object from a Runtime message. Also converts values to other types if specified. + * @param message Runtime + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.ListRuntimesResponse.Runtime, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Runtime to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** RuntimeStage enum. */ + enum RuntimeStage { + RUNTIME_STAGE_UNSPECIFIED = 0, + DEVELOPMENT = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5, + DECOMMISSIONED = 6 + } + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target */ + target?: (string|null); + + /** OperationMetadata verb */ + verb?: (string|null); + + /** OperationMetadata statusDetail */ + statusDetail?: (string|null); + + /** OperationMetadata cancelRequested */ + cancelRequested?: (boolean|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); + + /** OperationMetadata requestResource */ + requestResource?: (google.protobuf.IAny|null); + + /** OperationMetadata stages */ + stages?: (google.cloud.functions.v2beta.IStage[]|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IOperationMetadata); + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target. */ + public target: string; + + /** OperationMetadata verb. */ + public verb: string; + + /** OperationMetadata statusDetail. */ + public statusDetail: string; + + /** OperationMetadata cancelRequested. */ + public cancelRequested: boolean; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; + + /** OperationMetadata requestResource. */ + public requestResource?: (google.protobuf.IAny|null); + + /** OperationMetadata stages. */ + public stages: google.cloud.functions.v2beta.IStage[]; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.functions.v2beta.IOperationMetadata): google.cloud.functions.v2beta.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.functions.v2beta.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.OperationMetadata; + + /** + * Verifies an OperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Stage. */ + interface IStage { + + /** Stage name */ + name?: (google.cloud.functions.v2beta.Stage.Name|keyof typeof google.cloud.functions.v2beta.Stage.Name|null); + + /** Stage message */ + message?: (string|null); + + /** Stage state */ + state?: (google.cloud.functions.v2beta.Stage.State|keyof typeof google.cloud.functions.v2beta.Stage.State|null); + + /** Stage resource */ + resource?: (string|null); + + /** Stage resourceUri */ + resourceUri?: (string|null); + + /** Stage stateMessages */ + stateMessages?: (google.cloud.functions.v2beta.IStateMessage[]|null); + } + + /** Represents a Stage. */ + class Stage implements IStage { + + /** + * Constructs a new Stage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2beta.IStage); + + /** Stage name. */ + public name: (google.cloud.functions.v2beta.Stage.Name|keyof typeof google.cloud.functions.v2beta.Stage.Name); + + /** Stage message. */ + public message: string; + + /** Stage state. */ + public state: (google.cloud.functions.v2beta.Stage.State|keyof typeof google.cloud.functions.v2beta.Stage.State); + + /** Stage resource. */ + public resource: string; + + /** Stage resourceUri. */ + public resourceUri: string; + + /** Stage stateMessages. */ + public stateMessages: google.cloud.functions.v2beta.IStateMessage[]; + + /** + * Creates a new Stage instance using the specified properties. + * @param [properties] Properties to set + * @returns Stage instance + */ + public static create(properties?: google.cloud.functions.v2beta.IStage): google.cloud.functions.v2beta.Stage; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.cloud.functions.v2beta.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2beta.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2beta.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2beta.Stage; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2beta.Stage; + + /** + * Verifies a Stage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Stage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2beta.Stage; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @param message Stage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2beta.Stage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Stage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Stage { + + /** Name enum. */ + enum Name { + NAME_UNSPECIFIED = 0, + ARTIFACT_REGISTRY = 1, + BUILD = 2, + SERVICE = 3, + TRIGGER = 4, + SERVICE_ROLLBACK = 5, + TRIGGER_ROLLBACK = 6 + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + NOT_STARTED = 1, + IN_PROGRESS = 2, + COMPLETE = 3 + } + } + } } } diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 16156c91fa5..020f622ce89 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -6558,6 +6558,16758 @@ return v1; })(); + functions.v2alpha = (function() { + + /** + * Namespace v2alpha. + * @memberof google.cloud.functions + * @namespace + */ + var v2alpha = {}; + + v2alpha.FunctionService = (function() { + + /** + * Constructs a new FunctionService service. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a FunctionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function FunctionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (FunctionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = FunctionService; + + /** + * Creates new FunctionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.functions.v2alpha.FunctionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {FunctionService} RPC service. Useful where requests and/or responses are streamed. + */ + FunctionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#getFunction}. + * @memberof google.cloud.functions.v2alpha.FunctionService + * @typedef GetFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2alpha.Function} [response] Function + */ + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @param {google.cloud.functions.v2alpha.FunctionService.GetFunctionCallback} callback Node-style callback called with the error, if any, and Function + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.getFunction = function getFunction(request, callback) { + return this.rpcCall(getFunction, $root.google.cloud.functions.v2alpha.GetFunctionRequest, $root.google.cloud.functions.v2alpha.Function, request, callback); + }, "name", { value: "GetFunction" }); + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#listFunctions}. + * @memberof google.cloud.functions.v2alpha.FunctionService + * @typedef ListFunctionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2alpha.ListFunctionsResponse} [response] ListFunctionsResponse + */ + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @param {google.cloud.functions.v2alpha.FunctionService.ListFunctionsCallback} callback Node-style callback called with the error, if any, and ListFunctionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.listFunctions = function listFunctions(request, callback) { + return this.rpcCall(listFunctions, $root.google.cloud.functions.v2alpha.ListFunctionsRequest, $root.google.cloud.functions.v2alpha.ListFunctionsResponse, request, callback); + }, "name", { value: "ListFunctions" }); + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#createFunction}. + * @memberof google.cloud.functions.v2alpha.FunctionService + * @typedef CreateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @param {google.cloud.functions.v2alpha.FunctionService.CreateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.createFunction = function createFunction(request, callback) { + return this.rpcCall(createFunction, $root.google.cloud.functions.v2alpha.CreateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateFunction" }); + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#updateFunction}. + * @memberof google.cloud.functions.v2alpha.FunctionService + * @typedef UpdateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @param {google.cloud.functions.v2alpha.FunctionService.UpdateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.updateFunction = function updateFunction(request, callback) { + return this.rpcCall(updateFunction, $root.google.cloud.functions.v2alpha.UpdateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateFunction" }); + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#deleteFunction}. + * @memberof google.cloud.functions.v2alpha.FunctionService + * @typedef DeleteFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @param {google.cloud.functions.v2alpha.FunctionService.DeleteFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.deleteFunction = function deleteFunction(request, callback) { + return this.rpcCall(deleteFunction, $root.google.cloud.functions.v2alpha.DeleteFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteFunction" }); + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#generateUploadUrl}. + * @memberof google.cloud.functions.v2alpha.FunctionService + * @typedef GenerateUploadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2alpha.GenerateUploadUrlResponse} [response] GenerateUploadUrlResponse + */ + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @param {google.cloud.functions.v2alpha.FunctionService.GenerateUploadUrlCallback} callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.generateUploadUrl = function generateUploadUrl(request, callback) { + return this.rpcCall(generateUploadUrl, $root.google.cloud.functions.v2alpha.GenerateUploadUrlRequest, $root.google.cloud.functions.v2alpha.GenerateUploadUrlResponse, request, callback); + }, "name", { value: "GenerateUploadUrl" }); + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#generateDownloadUrl}. + * @memberof google.cloud.functions.v2alpha.FunctionService + * @typedef GenerateDownloadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2alpha.GenerateDownloadUrlResponse} [response] GenerateDownloadUrlResponse + */ + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @param {google.cloud.functions.v2alpha.FunctionService.GenerateDownloadUrlCallback} callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.generateDownloadUrl = function generateDownloadUrl(request, callback) { + return this.rpcCall(generateDownloadUrl, $root.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest, $root.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse, request, callback); + }, "name", { value: "GenerateDownloadUrl" }); + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#listRuntimes}. + * @memberof google.cloud.functions.v2alpha.FunctionService + * @typedef ListRuntimesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2alpha.ListRuntimesResponse} [response] ListRuntimesResponse + */ + + /** + * Calls ListRuntimes. + * @function listRuntimes + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IListRuntimesRequest} request ListRuntimesRequest message or plain object + * @param {google.cloud.functions.v2alpha.FunctionService.ListRuntimesCallback} callback Node-style callback called with the error, if any, and ListRuntimesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.listRuntimes = function listRuntimes(request, callback) { + return this.rpcCall(listRuntimes, $root.google.cloud.functions.v2alpha.ListRuntimesRequest, $root.google.cloud.functions.v2alpha.ListRuntimesResponse, request, callback); + }, "name", { value: "ListRuntimes" }); + + /** + * Calls ListRuntimes. + * @function listRuntimes + * @memberof google.cloud.functions.v2alpha.FunctionService + * @instance + * @param {google.cloud.functions.v2alpha.IListRuntimesRequest} request ListRuntimesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return FunctionService; + })(); + + /** + * Environment enum. + * @name google.cloud.functions.v2alpha.Environment + * @enum {number} + * @property {number} ENVIRONMENT_UNSPECIFIED=0 ENVIRONMENT_UNSPECIFIED value + * @property {number} GEN_1=1 GEN_1 value + * @property {number} GEN_2=2 GEN_2 value + */ + v2alpha.Environment = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENVIRONMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "GEN_1"] = 1; + values[valuesById[2] = "GEN_2"] = 2; + return values; + })(); + + v2alpha.Function = (function() { + + /** + * Properties of a Function. + * @memberof google.cloud.functions.v2alpha + * @interface IFunction + * @property {string|null} [name] Function name + * @property {google.cloud.functions.v2alpha.Environment|null} [environment] Function environment + * @property {string|null} [description] Function description + * @property {google.cloud.functions.v2alpha.IBuildConfig|null} [buildConfig] Function buildConfig + * @property {google.cloud.functions.v2alpha.IServiceConfig|null} [serviceConfig] Function serviceConfig + * @property {google.cloud.functions.v2alpha.IEventTrigger|null} [eventTrigger] Function eventTrigger + * @property {google.cloud.functions.v2alpha.Function.State|null} [state] Function state + * @property {google.protobuf.ITimestamp|null} [updateTime] Function updateTime + * @property {Object.|null} [labels] Function labels + * @property {Array.|null} [stateMessages] Function stateMessages + */ + + /** + * Constructs a new Function. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a Function. + * @implements IFunction + * @constructor + * @param {google.cloud.functions.v2alpha.IFunction=} [properties] Properties to set + */ + function Function(properties) { + this.labels = {}; + this.stateMessages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Function name. + * @member {string} name + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.name = ""; + + /** + * Function environment. + * @member {google.cloud.functions.v2alpha.Environment} environment + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.environment = 0; + + /** + * Function description. + * @member {string} description + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.description = ""; + + /** + * Function buildConfig. + * @member {google.cloud.functions.v2alpha.IBuildConfig|null|undefined} buildConfig + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.buildConfig = null; + + /** + * Function serviceConfig. + * @member {google.cloud.functions.v2alpha.IServiceConfig|null|undefined} serviceConfig + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.serviceConfig = null; + + /** + * Function eventTrigger. + * @member {google.cloud.functions.v2alpha.IEventTrigger|null|undefined} eventTrigger + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.eventTrigger = null; + + /** + * Function state. + * @member {google.cloud.functions.v2alpha.Function.State} state + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.state = 0; + + /** + * Function updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.updateTime = null; + + /** + * Function labels. + * @member {Object.} labels + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.labels = $util.emptyObject; + + /** + * Function stateMessages. + * @member {Array.} stateMessages + * @memberof google.cloud.functions.v2alpha.Function + * @instance + */ + Function.prototype.stateMessages = $util.emptyArray; + + /** + * Creates a new Function instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {google.cloud.functions.v2alpha.IFunction=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.Function} Function instance + */ + Function.create = function create(properties) { + return new Function(properties); + }; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.cloud.functions.v2alpha.Function.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {google.cloud.functions.v2alpha.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.buildConfig != null && Object.hasOwnProperty.call(message, "buildConfig")) + $root.google.cloud.functions.v2alpha.BuildConfig.encode(message.buildConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.serviceConfig != null && Object.hasOwnProperty.call(message, "serviceConfig")) + $root.google.cloud.functions.v2alpha.ServiceConfig.encode(message.serviceConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.eventTrigger != null && Object.hasOwnProperty.call(message, "eventTrigger")) + $root.google.cloud.functions.v2alpha.EventTrigger.encode(message.eventTrigger, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.stateMessages != null && message.stateMessages.length) + for (var i = 0; i < message.stateMessages.length; ++i) + $root.google.cloud.functions.v2alpha.StateMessage.encode(message.stateMessages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.environment); + return writer; + }; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.Function.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {google.cloud.functions.v2alpha.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Function message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.Function(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 10: + message.environment = reader.int32(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.buildConfig = $root.google.cloud.functions.v2alpha.BuildConfig.decode(reader, reader.uint32()); + break; + case 4: + message.serviceConfig = $root.google.cloud.functions.v2alpha.ServiceConfig.decode(reader, reader.uint32()); + break; + case 5: + message.eventTrigger = $root.google.cloud.functions.v2alpha.EventTrigger.decode(reader, reader.uint32()); + break; + case 6: + message.state = reader.int32(); + break; + case 7: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 9: + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2alpha.StateMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Function message. + * @function verify + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Function.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.environment != null && message.hasOwnProperty("environment")) + switch (message.environment) { + default: + return "environment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.buildConfig != null && message.hasOwnProperty("buildConfig")) { + var error = $root.google.cloud.functions.v2alpha.BuildConfig.verify(message.buildConfig); + if (error) + return "buildConfig." + error; + } + if (message.serviceConfig != null && message.hasOwnProperty("serviceConfig")) { + var error = $root.google.cloud.functions.v2alpha.ServiceConfig.verify(message.serviceConfig); + if (error) + return "serviceConfig." + error; + } + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) { + var error = $root.google.cloud.functions.v2alpha.EventTrigger.verify(message.eventTrigger); + if (error) + return "eventTrigger." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.stateMessages != null && message.hasOwnProperty("stateMessages")) { + if (!Array.isArray(message.stateMessages)) + return "stateMessages: array expected"; + for (var i = 0; i < message.stateMessages.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.StateMessage.verify(message.stateMessages[i]); + if (error) + return "stateMessages." + error; + } + } + return null; + }; + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.Function} Function + */ + Function.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.Function) + return object; + var message = new $root.google.cloud.functions.v2alpha.Function(); + if (object.name != null) + message.name = String(object.name); + switch (object.environment) { + case "ENVIRONMENT_UNSPECIFIED": + case 0: + message.environment = 0; + break; + case "GEN_1": + case 1: + message.environment = 1; + break; + case "GEN_2": + case 2: + message.environment = 2; + break; + } + if (object.description != null) + message.description = String(object.description); + if (object.buildConfig != null) { + if (typeof object.buildConfig !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Function.buildConfig: object expected"); + message.buildConfig = $root.google.cloud.functions.v2alpha.BuildConfig.fromObject(object.buildConfig); + } + if (object.serviceConfig != null) { + if (typeof object.serviceConfig !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Function.serviceConfig: object expected"); + message.serviceConfig = $root.google.cloud.functions.v2alpha.ServiceConfig.fromObject(object.serviceConfig); + } + if (object.eventTrigger != null) { + if (typeof object.eventTrigger !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Function.eventTrigger: object expected"); + message.eventTrigger = $root.google.cloud.functions.v2alpha.EventTrigger.fromObject(object.eventTrigger); + } + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACTIVE": + case 1: + message.state = 1; + break; + case "FAILED": + case 2: + message.state = 2; + break; + case "DEPLOYING": + case 3: + message.state = 3; + break; + case "DELETING": + case 4: + message.state = 4; + break; + case "UNKNOWN": + case 5: + message.state = 5; + break; + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Function.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Function.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.stateMessages) { + if (!Array.isArray(object.stateMessages)) + throw TypeError(".google.cloud.functions.v2alpha.Function.stateMessages: array expected"); + message.stateMessages = []; + for (var i = 0; i < object.stateMessages.length; ++i) { + if (typeof object.stateMessages[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Function.stateMessages: object expected"); + message.stateMessages[i] = $root.google.cloud.functions.v2alpha.StateMessage.fromObject(object.stateMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {google.cloud.functions.v2alpha.Function} message Function + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Function.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stateMessages = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.buildConfig = null; + object.serviceConfig = null; + object.eventTrigger = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.updateTime = null; + object.environment = options.enums === String ? "ENVIRONMENT_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.buildConfig != null && message.hasOwnProperty("buildConfig")) + object.buildConfig = $root.google.cloud.functions.v2alpha.BuildConfig.toObject(message.buildConfig, options); + if (message.serviceConfig != null && message.hasOwnProperty("serviceConfig")) + object.serviceConfig = $root.google.cloud.functions.v2alpha.ServiceConfig.toObject(message.serviceConfig, options); + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) + object.eventTrigger = $root.google.cloud.functions.v2alpha.EventTrigger.toObject(message.eventTrigger, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.functions.v2alpha.Function.State[message.state] : message.state; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.stateMessages && message.stateMessages.length) { + object.stateMessages = []; + for (var j = 0; j < message.stateMessages.length; ++j) + object.stateMessages[j] = $root.google.cloud.functions.v2alpha.StateMessage.toObject(message.stateMessages[j], options); + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = options.enums === String ? $root.google.cloud.functions.v2alpha.Environment[message.environment] : message.environment; + return object; + }; + + /** + * Converts this Function to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.Function + * @instance + * @returns {Object.} JSON object + */ + Function.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.functions.v2alpha.Function.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} FAILED=2 FAILED value + * @property {number} DEPLOYING=3 DEPLOYING value + * @property {number} DELETING=4 DELETING value + * @property {number} UNKNOWN=5 UNKNOWN value + */ + Function.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "FAILED"] = 2; + values[valuesById[3] = "DEPLOYING"] = 3; + values[valuesById[4] = "DELETING"] = 4; + values[valuesById[5] = "UNKNOWN"] = 5; + return values; + })(); + + return Function; + })(); + + v2alpha.StateMessage = (function() { + + /** + * Properties of a StateMessage. + * @memberof google.cloud.functions.v2alpha + * @interface IStateMessage + * @property {google.cloud.functions.v2alpha.StateMessage.Severity|null} [severity] StateMessage severity + * @property {string|null} [type] StateMessage type + * @property {string|null} [message] StateMessage message + */ + + /** + * Constructs a new StateMessage. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a StateMessage. + * @implements IStateMessage + * @constructor + * @param {google.cloud.functions.v2alpha.IStateMessage=} [properties] Properties to set + */ + function StateMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StateMessage severity. + * @member {google.cloud.functions.v2alpha.StateMessage.Severity} severity + * @memberof google.cloud.functions.v2alpha.StateMessage + * @instance + */ + StateMessage.prototype.severity = 0; + + /** + * StateMessage type. + * @member {string} type + * @memberof google.cloud.functions.v2alpha.StateMessage + * @instance + */ + StateMessage.prototype.type = ""; + + /** + * StateMessage message. + * @member {string} message + * @memberof google.cloud.functions.v2alpha.StateMessage + * @instance + */ + StateMessage.prototype.message = ""; + + /** + * Creates a new StateMessage instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {google.cloud.functions.v2alpha.IStateMessage=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.StateMessage} StateMessage instance + */ + StateMessage.create = function create(properties) { + return new StateMessage(properties); + }; + + /** + * Encodes the specified StateMessage message. Does not implicitly {@link google.cloud.functions.v2alpha.StateMessage.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {google.cloud.functions.v2alpha.IStateMessage} message StateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.severity); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified StateMessage message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.StateMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {google.cloud.functions.v2alpha.IStateMessage} message StateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StateMessage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.StateMessage} StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.StateMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.severity = reader.int32(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StateMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.StateMessage} StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StateMessage message. + * @function verify + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StateMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.severity != null && message.hasOwnProperty("severity")) + switch (message.severity) { + default: + return "severity: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a StateMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.StateMessage} StateMessage + */ + StateMessage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.StateMessage) + return object; + var message = new $root.google.cloud.functions.v2alpha.StateMessage(); + switch (object.severity) { + case "SEVERITY_UNSPECIFIED": + case 0: + message.severity = 0; + break; + case "ERROR": + case 1: + message.severity = 1; + break; + case "WARNING": + case 2: + message.severity = 2; + break; + case "INFO": + case 3: + message.severity = 3; + break; + } + if (object.type != null) + message.type = String(object.type); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a StateMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {google.cloud.functions.v2alpha.StateMessage} message StateMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StateMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.severity = options.enums === String ? "SEVERITY_UNSPECIFIED" : 0; + object.type = ""; + object.message = ""; + } + if (message.severity != null && message.hasOwnProperty("severity")) + object.severity = options.enums === String ? $root.google.cloud.functions.v2alpha.StateMessage.Severity[message.severity] : message.severity; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this StateMessage to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.StateMessage + * @instance + * @returns {Object.} JSON object + */ + StateMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Severity enum. + * @name google.cloud.functions.v2alpha.StateMessage.Severity + * @enum {number} + * @property {number} SEVERITY_UNSPECIFIED=0 SEVERITY_UNSPECIFIED value + * @property {number} ERROR=1 ERROR value + * @property {number} WARNING=2 WARNING value + * @property {number} INFO=3 INFO value + */ + StateMessage.Severity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEVERITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ERROR"] = 1; + values[valuesById[2] = "WARNING"] = 2; + values[valuesById[3] = "INFO"] = 3; + return values; + })(); + + return StateMessage; + })(); + + v2alpha.StorageSource = (function() { + + /** + * Properties of a StorageSource. + * @memberof google.cloud.functions.v2alpha + * @interface IStorageSource + * @property {string|null} [bucket] StorageSource bucket + * @property {string|null} [object] StorageSource object + * @property {number|Long|null} [generation] StorageSource generation + */ + + /** + * Constructs a new StorageSource. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a StorageSource. + * @implements IStorageSource + * @constructor + * @param {google.cloud.functions.v2alpha.IStorageSource=} [properties] Properties to set + */ + function StorageSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StorageSource bucket. + * @member {string} bucket + * @memberof google.cloud.functions.v2alpha.StorageSource + * @instance + */ + StorageSource.prototype.bucket = ""; + + /** + * StorageSource object. + * @member {string} object + * @memberof google.cloud.functions.v2alpha.StorageSource + * @instance + */ + StorageSource.prototype.object = ""; + + /** + * StorageSource generation. + * @member {number|Long} generation + * @memberof google.cloud.functions.v2alpha.StorageSource + * @instance + */ + StorageSource.prototype.generation = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new StorageSource instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {google.cloud.functions.v2alpha.IStorageSource=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.StorageSource} StorageSource instance + */ + StorageSource.create = function create(properties) { + return new StorageSource(properties); + }; + + /** + * Encodes the specified StorageSource message. Does not implicitly {@link google.cloud.functions.v2alpha.StorageSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {google.cloud.functions.v2alpha.IStorageSource} message StorageSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.bucket); + if (message.object != null && Object.hasOwnProperty.call(message, "object")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.object); + if (message.generation != null && Object.hasOwnProperty.call(message, "generation")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.generation); + return writer; + }; + + /** + * Encodes the specified StorageSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.StorageSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {google.cloud.functions.v2alpha.IStorageSource} message StorageSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StorageSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.StorageSource} StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.StorageSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bucket = reader.string(); + break; + case 2: + message.object = reader.string(); + break; + case 3: + message.generation = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StorageSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.StorageSource} StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StorageSource message. + * @function verify + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StorageSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) + if (!$util.isString(message.bucket)) + return "bucket: string expected"; + if (message.object != null && message.hasOwnProperty("object")) + if (!$util.isString(message.object)) + return "object: string expected"; + if (message.generation != null && message.hasOwnProperty("generation")) + if (!$util.isInteger(message.generation) && !(message.generation && $util.isInteger(message.generation.low) && $util.isInteger(message.generation.high))) + return "generation: integer|Long expected"; + return null; + }; + + /** + * Creates a StorageSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.StorageSource} StorageSource + */ + StorageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.StorageSource) + return object; + var message = new $root.google.cloud.functions.v2alpha.StorageSource(); + if (object.bucket != null) + message.bucket = String(object.bucket); + if (object.object != null) + message.object = String(object.object); + if (object.generation != null) + if ($util.Long) + (message.generation = $util.Long.fromValue(object.generation)).unsigned = false; + else if (typeof object.generation === "string") + message.generation = parseInt(object.generation, 10); + else if (typeof object.generation === "number") + message.generation = object.generation; + else if (typeof object.generation === "object") + message.generation = new $util.LongBits(object.generation.low >>> 0, object.generation.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a StorageSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {google.cloud.functions.v2alpha.StorageSource} message StorageSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StorageSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.bucket = ""; + object.object = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.generation = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.generation = options.longs === String ? "0" : 0; + } + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = message.bucket; + if (message.object != null && message.hasOwnProperty("object")) + object.object = message.object; + if (message.generation != null && message.hasOwnProperty("generation")) + if (typeof message.generation === "number") + object.generation = options.longs === String ? String(message.generation) : message.generation; + else + object.generation = options.longs === String ? $util.Long.prototype.toString.call(message.generation) : options.longs === Number ? new $util.LongBits(message.generation.low >>> 0, message.generation.high >>> 0).toNumber() : message.generation; + return object; + }; + + /** + * Converts this StorageSource to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.StorageSource + * @instance + * @returns {Object.} JSON object + */ + StorageSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StorageSource; + })(); + + v2alpha.RepoSource = (function() { + + /** + * Properties of a RepoSource. + * @memberof google.cloud.functions.v2alpha + * @interface IRepoSource + * @property {string|null} [branchName] RepoSource branchName + * @property {string|null} [tagName] RepoSource tagName + * @property {string|null} [commitSha] RepoSource commitSha + * @property {string|null} [projectId] RepoSource projectId + * @property {string|null} [repoName] RepoSource repoName + * @property {string|null} [dir] RepoSource dir + * @property {boolean|null} [invertRegex] RepoSource invertRegex + */ + + /** + * Constructs a new RepoSource. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a RepoSource. + * @implements IRepoSource + * @constructor + * @param {google.cloud.functions.v2alpha.IRepoSource=} [properties] Properties to set + */ + function RepoSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RepoSource branchName. + * @member {string|null|undefined} branchName + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + */ + RepoSource.prototype.branchName = null; + + /** + * RepoSource tagName. + * @member {string|null|undefined} tagName + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + */ + RepoSource.prototype.tagName = null; + + /** + * RepoSource commitSha. + * @member {string|null|undefined} commitSha + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + */ + RepoSource.prototype.commitSha = null; + + /** + * RepoSource projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + */ + RepoSource.prototype.projectId = ""; + + /** + * RepoSource repoName. + * @member {string} repoName + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + */ + RepoSource.prototype.repoName = ""; + + /** + * RepoSource dir. + * @member {string} dir + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + */ + RepoSource.prototype.dir = ""; + + /** + * RepoSource invertRegex. + * @member {boolean} invertRegex + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + */ + RepoSource.prototype.invertRegex = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RepoSource revision. + * @member {"branchName"|"tagName"|"commitSha"|undefined} revision + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + */ + Object.defineProperty(RepoSource.prototype, "revision", { + get: $util.oneOfGetter($oneOfFields = ["branchName", "tagName", "commitSha"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RepoSource instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {google.cloud.functions.v2alpha.IRepoSource=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.RepoSource} RepoSource instance + */ + RepoSource.create = function create(properties) { + return new RepoSource(properties); + }; + + /** + * Encodes the specified RepoSource message. Does not implicitly {@link google.cloud.functions.v2alpha.RepoSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {google.cloud.functions.v2alpha.IRepoSource} message RepoSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RepoSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); + if (message.repoName != null && Object.hasOwnProperty.call(message, "repoName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.repoName); + if (message.branchName != null && Object.hasOwnProperty.call(message, "branchName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.branchName); + if (message.tagName != null && Object.hasOwnProperty.call(message, "tagName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.tagName); + if (message.commitSha != null && Object.hasOwnProperty.call(message, "commitSha")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.commitSha); + if (message.dir != null && Object.hasOwnProperty.call(message, "dir")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dir); + if (message.invertRegex != null && Object.hasOwnProperty.call(message, "invertRegex")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.invertRegex); + return writer; + }; + + /** + * Encodes the specified RepoSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.RepoSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {google.cloud.functions.v2alpha.IRepoSource} message RepoSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RepoSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RepoSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.RepoSource} RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RepoSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.RepoSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.branchName = reader.string(); + break; + case 4: + message.tagName = reader.string(); + break; + case 5: + message.commitSha = reader.string(); + break; + case 1: + message.projectId = reader.string(); + break; + case 2: + message.repoName = reader.string(); + break; + case 6: + message.dir = reader.string(); + break; + case 7: + message.invertRegex = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RepoSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.RepoSource} RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RepoSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RepoSource message. + * @function verify + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RepoSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.branchName != null && message.hasOwnProperty("branchName")) { + properties.revision = 1; + if (!$util.isString(message.branchName)) + return "branchName: string expected"; + } + if (message.tagName != null && message.hasOwnProperty("tagName")) { + if (properties.revision === 1) + return "revision: multiple values"; + properties.revision = 1; + if (!$util.isString(message.tagName)) + return "tagName: string expected"; + } + if (message.commitSha != null && message.hasOwnProperty("commitSha")) { + if (properties.revision === 1) + return "revision: multiple values"; + properties.revision = 1; + if (!$util.isString(message.commitSha)) + return "commitSha: string expected"; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.repoName != null && message.hasOwnProperty("repoName")) + if (!$util.isString(message.repoName)) + return "repoName: string expected"; + if (message.dir != null && message.hasOwnProperty("dir")) + if (!$util.isString(message.dir)) + return "dir: string expected"; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + if (typeof message.invertRegex !== "boolean") + return "invertRegex: boolean expected"; + return null; + }; + + /** + * Creates a RepoSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.RepoSource} RepoSource + */ + RepoSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.RepoSource) + return object; + var message = new $root.google.cloud.functions.v2alpha.RepoSource(); + if (object.branchName != null) + message.branchName = String(object.branchName); + if (object.tagName != null) + message.tagName = String(object.tagName); + if (object.commitSha != null) + message.commitSha = String(object.commitSha); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.repoName != null) + message.repoName = String(object.repoName); + if (object.dir != null) + message.dir = String(object.dir); + if (object.invertRegex != null) + message.invertRegex = Boolean(object.invertRegex); + return message; + }; + + /** + * Creates a plain object from a RepoSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {google.cloud.functions.v2alpha.RepoSource} message RepoSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RepoSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.projectId = ""; + object.repoName = ""; + object.dir = ""; + object.invertRegex = false; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.repoName != null && message.hasOwnProperty("repoName")) + object.repoName = message.repoName; + if (message.branchName != null && message.hasOwnProperty("branchName")) { + object.branchName = message.branchName; + if (options.oneofs) + object.revision = "branchName"; + } + if (message.tagName != null && message.hasOwnProperty("tagName")) { + object.tagName = message.tagName; + if (options.oneofs) + object.revision = "tagName"; + } + if (message.commitSha != null && message.hasOwnProperty("commitSha")) { + object.commitSha = message.commitSha; + if (options.oneofs) + object.revision = "commitSha"; + } + if (message.dir != null && message.hasOwnProperty("dir")) + object.dir = message.dir; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + object.invertRegex = message.invertRegex; + return object; + }; + + /** + * Converts this RepoSource to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.RepoSource + * @instance + * @returns {Object.} JSON object + */ + RepoSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RepoSource; + })(); + + v2alpha.Source = (function() { + + /** + * Properties of a Source. + * @memberof google.cloud.functions.v2alpha + * @interface ISource + * @property {google.cloud.functions.v2alpha.IStorageSource|null} [storageSource] Source storageSource + * @property {google.cloud.functions.v2alpha.IRepoSource|null} [repoSource] Source repoSource + */ + + /** + * Constructs a new Source. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a Source. + * @implements ISource + * @constructor + * @param {google.cloud.functions.v2alpha.ISource=} [properties] Properties to set + */ + function Source(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Source storageSource. + * @member {google.cloud.functions.v2alpha.IStorageSource|null|undefined} storageSource + * @memberof google.cloud.functions.v2alpha.Source + * @instance + */ + Source.prototype.storageSource = null; + + /** + * Source repoSource. + * @member {google.cloud.functions.v2alpha.IRepoSource|null|undefined} repoSource + * @memberof google.cloud.functions.v2alpha.Source + * @instance + */ + Source.prototype.repoSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Source source. + * @member {"storageSource"|"repoSource"|undefined} source + * @memberof google.cloud.functions.v2alpha.Source + * @instance + */ + Object.defineProperty(Source.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["storageSource", "repoSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Source instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {google.cloud.functions.v2alpha.ISource=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.Source} Source instance + */ + Source.create = function create(properties) { + return new Source(properties); + }; + + /** + * Encodes the specified Source message. Does not implicitly {@link google.cloud.functions.v2alpha.Source.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {google.cloud.functions.v2alpha.ISource} message Source message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Source.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.storageSource != null && Object.hasOwnProperty.call(message, "storageSource")) + $root.google.cloud.functions.v2alpha.StorageSource.encode(message.storageSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.repoSource != null && Object.hasOwnProperty.call(message, "repoSource")) + $root.google.cloud.functions.v2alpha.RepoSource.encode(message.repoSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Source message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.Source.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {google.cloud.functions.v2alpha.ISource} message Source message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Source.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Source message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.Source} Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Source.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.Source(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); + break; + case 2: + message.repoSource = $root.google.cloud.functions.v2alpha.RepoSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Source message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.Source} Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Source.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Source message. + * @function verify + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Source.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + properties.source = 1; + { + var error = $root.google.cloud.functions.v2alpha.StorageSource.verify(message.storageSource); + if (error) + return "storageSource." + error; + } + } + if (message.repoSource != null && message.hasOwnProperty("repoSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.functions.v2alpha.RepoSource.verify(message.repoSource); + if (error) + return "repoSource." + error; + } + } + return null; + }; + + /** + * Creates a Source message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.Source} Source + */ + Source.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.Source) + return object; + var message = new $root.google.cloud.functions.v2alpha.Source(); + if (object.storageSource != null) { + if (typeof object.storageSource !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Source.storageSource: object expected"); + message.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.fromObject(object.storageSource); + } + if (object.repoSource != null) { + if (typeof object.repoSource !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Source.repoSource: object expected"); + message.repoSource = $root.google.cloud.functions.v2alpha.RepoSource.fromObject(object.repoSource); + } + return message; + }; + + /** + * Creates a plain object from a Source message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {google.cloud.functions.v2alpha.Source} message Source + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Source.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + object.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.toObject(message.storageSource, options); + if (options.oneofs) + object.source = "storageSource"; + } + if (message.repoSource != null && message.hasOwnProperty("repoSource")) { + object.repoSource = $root.google.cloud.functions.v2alpha.RepoSource.toObject(message.repoSource, options); + if (options.oneofs) + object.source = "repoSource"; + } + return object; + }; + + /** + * Converts this Source to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.Source + * @instance + * @returns {Object.} JSON object + */ + Source.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Source; + })(); + + v2alpha.SourceProvenance = (function() { + + /** + * Properties of a SourceProvenance. + * @memberof google.cloud.functions.v2alpha + * @interface ISourceProvenance + * @property {google.cloud.functions.v2alpha.IStorageSource|null} [resolvedStorageSource] SourceProvenance resolvedStorageSource + * @property {google.cloud.functions.v2alpha.IRepoSource|null} [resolvedRepoSource] SourceProvenance resolvedRepoSource + */ + + /** + * Constructs a new SourceProvenance. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a SourceProvenance. + * @implements ISourceProvenance + * @constructor + * @param {google.cloud.functions.v2alpha.ISourceProvenance=} [properties] Properties to set + */ + function SourceProvenance(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceProvenance resolvedStorageSource. + * @member {google.cloud.functions.v2alpha.IStorageSource|null|undefined} resolvedStorageSource + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedStorageSource = null; + + /** + * SourceProvenance resolvedRepoSource. + * @member {google.cloud.functions.v2alpha.IRepoSource|null|undefined} resolvedRepoSource + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedRepoSource = null; + + /** + * Creates a new SourceProvenance instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {google.cloud.functions.v2alpha.ISourceProvenance=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.SourceProvenance} SourceProvenance instance + */ + SourceProvenance.create = function create(properties) { + return new SourceProvenance(properties); + }; + + /** + * Encodes the specified SourceProvenance message. Does not implicitly {@link google.cloud.functions.v2alpha.SourceProvenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {google.cloud.functions.v2alpha.ISourceProvenance} message SourceProvenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceProvenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resolvedStorageSource != null && Object.hasOwnProperty.call(message, "resolvedStorageSource")) + $root.google.cloud.functions.v2alpha.StorageSource.encode(message.resolvedStorageSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.resolvedRepoSource != null && Object.hasOwnProperty.call(message, "resolvedRepoSource")) + $root.google.cloud.functions.v2alpha.RepoSource.encode(message.resolvedRepoSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceProvenance message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.SourceProvenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {google.cloud.functions.v2alpha.ISourceProvenance} message SourceProvenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceProvenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.SourceProvenance} SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceProvenance.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.SourceProvenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resolvedStorageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); + break; + case 2: + message.resolvedRepoSource = $root.google.cloud.functions.v2alpha.RepoSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.SourceProvenance} SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceProvenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceProvenance message. + * @function verify + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceProvenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) { + var error = $root.google.cloud.functions.v2alpha.StorageSource.verify(message.resolvedStorageSource); + if (error) + return "resolvedStorageSource." + error; + } + if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) { + var error = $root.google.cloud.functions.v2alpha.RepoSource.verify(message.resolvedRepoSource); + if (error) + return "resolvedRepoSource." + error; + } + return null; + }; + + /** + * Creates a SourceProvenance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.SourceProvenance} SourceProvenance + */ + SourceProvenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.SourceProvenance) + return object; + var message = new $root.google.cloud.functions.v2alpha.SourceProvenance(); + if (object.resolvedStorageSource != null) { + if (typeof object.resolvedStorageSource !== "object") + throw TypeError(".google.cloud.functions.v2alpha.SourceProvenance.resolvedStorageSource: object expected"); + message.resolvedStorageSource = $root.google.cloud.functions.v2alpha.StorageSource.fromObject(object.resolvedStorageSource); + } + if (object.resolvedRepoSource != null) { + if (typeof object.resolvedRepoSource !== "object") + throw TypeError(".google.cloud.functions.v2alpha.SourceProvenance.resolvedRepoSource: object expected"); + message.resolvedRepoSource = $root.google.cloud.functions.v2alpha.RepoSource.fromObject(object.resolvedRepoSource); + } + return message; + }; + + /** + * Creates a plain object from a SourceProvenance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {google.cloud.functions.v2alpha.SourceProvenance} message SourceProvenance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceProvenance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resolvedStorageSource = null; + object.resolvedRepoSource = null; + } + if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) + object.resolvedStorageSource = $root.google.cloud.functions.v2alpha.StorageSource.toObject(message.resolvedStorageSource, options); + if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) + object.resolvedRepoSource = $root.google.cloud.functions.v2alpha.RepoSource.toObject(message.resolvedRepoSource, options); + return object; + }; + + /** + * Converts this SourceProvenance to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @instance + * @returns {Object.} JSON object + */ + SourceProvenance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SourceProvenance; + })(); + + v2alpha.BuildConfig = (function() { + + /** + * Properties of a BuildConfig. + * @memberof google.cloud.functions.v2alpha + * @interface IBuildConfig + * @property {string|null} [build] BuildConfig build + * @property {string|null} [runtime] BuildConfig runtime + * @property {string|null} [entryPoint] BuildConfig entryPoint + * @property {google.cloud.functions.v2alpha.ISource|null} [source] BuildConfig source + * @property {google.cloud.functions.v2alpha.ISourceProvenance|null} [sourceProvenance] BuildConfig sourceProvenance + * @property {string|null} [workerPool] BuildConfig workerPool + * @property {Object.|null} [environmentVariables] BuildConfig environmentVariables + * @property {string|null} [dockerRepository] BuildConfig dockerRepository + */ + + /** + * Constructs a new BuildConfig. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a BuildConfig. + * @implements IBuildConfig + * @constructor + * @param {google.cloud.functions.v2alpha.IBuildConfig=} [properties] Properties to set + */ + function BuildConfig(properties) { + this.environmentVariables = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BuildConfig build. + * @member {string} build + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + */ + BuildConfig.prototype.build = ""; + + /** + * BuildConfig runtime. + * @member {string} runtime + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + */ + BuildConfig.prototype.runtime = ""; + + /** + * BuildConfig entryPoint. + * @member {string} entryPoint + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + */ + BuildConfig.prototype.entryPoint = ""; + + /** + * BuildConfig source. + * @member {google.cloud.functions.v2alpha.ISource|null|undefined} source + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + */ + BuildConfig.prototype.source = null; + + /** + * BuildConfig sourceProvenance. + * @member {google.cloud.functions.v2alpha.ISourceProvenance|null|undefined} sourceProvenance + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + */ + BuildConfig.prototype.sourceProvenance = null; + + /** + * BuildConfig workerPool. + * @member {string} workerPool + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + */ + BuildConfig.prototype.workerPool = ""; + + /** + * BuildConfig environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + */ + BuildConfig.prototype.environmentVariables = $util.emptyObject; + + /** + * BuildConfig dockerRepository. + * @member {string} dockerRepository + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + */ + BuildConfig.prototype.dockerRepository = ""; + + /** + * Creates a new BuildConfig instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {google.cloud.functions.v2alpha.IBuildConfig=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.BuildConfig} BuildConfig instance + */ + BuildConfig.create = function create(properties) { + return new BuildConfig(properties); + }; + + /** + * Encodes the specified BuildConfig message. Does not implicitly {@link google.cloud.functions.v2alpha.BuildConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {google.cloud.functions.v2alpha.IBuildConfig} message BuildConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.build != null && Object.hasOwnProperty.call(message, "build")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.build); + if (message.runtime != null && Object.hasOwnProperty.call(message, "runtime")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.runtime); + if (message.entryPoint != null && Object.hasOwnProperty.call(message, "entryPoint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.entryPoint); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + $root.google.cloud.functions.v2alpha.Source.encode(message.source, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.workerPool != null && Object.hasOwnProperty.call(message, "workerPool")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.workerPool); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environmentVariables[keys[i]]).ldelim(); + if (message.dockerRepository != null && Object.hasOwnProperty.call(message, "dockerRepository")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.dockerRepository); + if (message.sourceProvenance != null && Object.hasOwnProperty.call(message, "sourceProvenance")) + $root.google.cloud.functions.v2alpha.SourceProvenance.encode(message.sourceProvenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BuildConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.BuildConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {google.cloud.functions.v2alpha.IBuildConfig} message BuildConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BuildConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.BuildConfig} BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.BuildConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.build = reader.string(); + break; + case 2: + message.runtime = reader.string(); + break; + case 3: + message.entryPoint = reader.string(); + break; + case 4: + message.source = $root.google.cloud.functions.v2alpha.Source.decode(reader, reader.uint32()); + break; + case 8: + message.sourceProvenance = $root.google.cloud.functions.v2alpha.SourceProvenance.decode(reader, reader.uint32()); + break; + case 5: + message.workerPool = reader.string(); + break; + case 6: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.environmentVariables[key] = value; + break; + case 7: + message.dockerRepository = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BuildConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.BuildConfig} BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BuildConfig message. + * @function verify + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BuildConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.build != null && message.hasOwnProperty("build")) + if (!$util.isString(message.build)) + return "build: string expected"; + if (message.runtime != null && message.hasOwnProperty("runtime")) + if (!$util.isString(message.runtime)) + return "runtime: string expected"; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + if (!$util.isString(message.entryPoint)) + return "entryPoint: string expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.functions.v2alpha.Source.verify(message.source); + if (error) + return "source." + error; + } + if (message.sourceProvenance != null && message.hasOwnProperty("sourceProvenance")) { + var error = $root.google.cloud.functions.v2alpha.SourceProvenance.verify(message.sourceProvenance); + if (error) + return "sourceProvenance." + error; + } + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + if (!$util.isString(message.workerPool)) + return "workerPool: string expected"; + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + if (!$util.isString(message.dockerRepository)) + return "dockerRepository: string expected"; + return null; + }; + + /** + * Creates a BuildConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.BuildConfig} BuildConfig + */ + BuildConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.BuildConfig) + return object; + var message = new $root.google.cloud.functions.v2alpha.BuildConfig(); + if (object.build != null) + message.build = String(object.build); + if (object.runtime != null) + message.runtime = String(object.runtime); + if (object.entryPoint != null) + message.entryPoint = String(object.entryPoint); + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.functions.v2alpha.BuildConfig.source: object expected"); + message.source = $root.google.cloud.functions.v2alpha.Source.fromObject(object.source); + } + if (object.sourceProvenance != null) { + if (typeof object.sourceProvenance !== "object") + throw TypeError(".google.cloud.functions.v2alpha.BuildConfig.sourceProvenance: object expected"); + message.sourceProvenance = $root.google.cloud.functions.v2alpha.SourceProvenance.fromObject(object.sourceProvenance); + } + if (object.workerPool != null) + message.workerPool = String(object.workerPool); + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v2alpha.BuildConfig.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.dockerRepository != null) + message.dockerRepository = String(object.dockerRepository); + return message; + }; + + /** + * Creates a plain object from a BuildConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {google.cloud.functions.v2alpha.BuildConfig} message BuildConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BuildConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.environmentVariables = {}; + if (options.defaults) { + object.build = ""; + object.runtime = ""; + object.entryPoint = ""; + object.source = null; + object.workerPool = ""; + object.dockerRepository = ""; + object.sourceProvenance = null; + } + if (message.build != null && message.hasOwnProperty("build")) + object.build = message.build; + if (message.runtime != null && message.hasOwnProperty("runtime")) + object.runtime = message.runtime; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + object.entryPoint = message.entryPoint; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.functions.v2alpha.Source.toObject(message.source, options); + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + object.workerPool = message.workerPool; + var keys2; + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + object.dockerRepository = message.dockerRepository; + if (message.sourceProvenance != null && message.hasOwnProperty("sourceProvenance")) + object.sourceProvenance = $root.google.cloud.functions.v2alpha.SourceProvenance.toObject(message.sourceProvenance, options); + return object; + }; + + /** + * Converts this BuildConfig to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @instance + * @returns {Object.} JSON object + */ + BuildConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BuildConfig; + })(); + + v2alpha.ServiceConfig = (function() { + + /** + * Properties of a ServiceConfig. + * @memberof google.cloud.functions.v2alpha + * @interface IServiceConfig + * @property {string|null} [service] ServiceConfig service + * @property {number|null} [timeoutSeconds] ServiceConfig timeoutSeconds + * @property {string|null} [availableMemory] ServiceConfig availableMemory + * @property {Object.|null} [environmentVariables] ServiceConfig environmentVariables + * @property {number|null} [maxInstanceCount] ServiceConfig maxInstanceCount + * @property {number|null} [minInstanceCount] ServiceConfig minInstanceCount + * @property {string|null} [vpcConnector] ServiceConfig vpcConnector + * @property {google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings|null} [vpcConnectorEgressSettings] ServiceConfig vpcConnectorEgressSettings + * @property {google.cloud.functions.v2alpha.ServiceConfig.IngressSettings|null} [ingressSettings] ServiceConfig ingressSettings + * @property {string|null} [uri] ServiceConfig uri + * @property {string|null} [serviceAccountEmail] ServiceConfig serviceAccountEmail + * @property {boolean|null} [allTrafficOnLatestRevision] ServiceConfig allTrafficOnLatestRevision + * @property {Array.|null} [secretEnvironmentVariables] ServiceConfig secretEnvironmentVariables + * @property {Array.|null} [secretVolumes] ServiceConfig secretVolumes + * @property {string|null} [revision] ServiceConfig revision + */ + + /** + * Constructs a new ServiceConfig. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a ServiceConfig. + * @implements IServiceConfig + * @constructor + * @param {google.cloud.functions.v2alpha.IServiceConfig=} [properties] Properties to set + */ + function ServiceConfig(properties) { + this.environmentVariables = {}; + this.secretEnvironmentVariables = []; + this.secretVolumes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceConfig service. + * @member {string} service + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.service = ""; + + /** + * ServiceConfig timeoutSeconds. + * @member {number} timeoutSeconds + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.timeoutSeconds = 0; + + /** + * ServiceConfig availableMemory. + * @member {string} availableMemory + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.availableMemory = ""; + + /** + * ServiceConfig environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.environmentVariables = $util.emptyObject; + + /** + * ServiceConfig maxInstanceCount. + * @member {number} maxInstanceCount + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.maxInstanceCount = 0; + + /** + * ServiceConfig minInstanceCount. + * @member {number} minInstanceCount + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.minInstanceCount = 0; + + /** + * ServiceConfig vpcConnector. + * @member {string} vpcConnector + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.vpcConnector = ""; + + /** + * ServiceConfig vpcConnectorEgressSettings. + * @member {google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings} vpcConnectorEgressSettings + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.vpcConnectorEgressSettings = 0; + + /** + * ServiceConfig ingressSettings. + * @member {google.cloud.functions.v2alpha.ServiceConfig.IngressSettings} ingressSettings + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.ingressSettings = 0; + + /** + * ServiceConfig uri. + * @member {string} uri + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.uri = ""; + + /** + * ServiceConfig serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.serviceAccountEmail = ""; + + /** + * ServiceConfig allTrafficOnLatestRevision. + * @member {boolean} allTrafficOnLatestRevision + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.allTrafficOnLatestRevision = false; + + /** + * ServiceConfig secretEnvironmentVariables. + * @member {Array.} secretEnvironmentVariables + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.secretEnvironmentVariables = $util.emptyArray; + + /** + * ServiceConfig secretVolumes. + * @member {Array.} secretVolumes + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.secretVolumes = $util.emptyArray; + + /** + * ServiceConfig revision. + * @member {string} revision + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + */ + ServiceConfig.prototype.revision = ""; + + /** + * Creates a new ServiceConfig instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {google.cloud.functions.v2alpha.IServiceConfig=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.ServiceConfig} ServiceConfig instance + */ + ServiceConfig.create = function create(properties) { + return new ServiceConfig(properties); + }; + + /** + * Encodes the specified ServiceConfig message. Does not implicitly {@link google.cloud.functions.v2alpha.ServiceConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {google.cloud.functions.v2alpha.IServiceConfig} message ServiceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.service); + if (message.timeoutSeconds != null && Object.hasOwnProperty.call(message, "timeoutSeconds")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.timeoutSeconds); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environmentVariables[keys[i]]).ldelim(); + if (message.maxInstanceCount != null && Object.hasOwnProperty.call(message, "maxInstanceCount")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxInstanceCount); + if (message.vpcConnector != null && Object.hasOwnProperty.call(message, "vpcConnector")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.vpcConnector); + if (message.vpcConnectorEgressSettings != null && Object.hasOwnProperty.call(message, "vpcConnectorEgressSettings")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.vpcConnectorEgressSettings); + if (message.ingressSettings != null && Object.hasOwnProperty.call(message, "ingressSettings")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.ingressSettings); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.uri); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.serviceAccountEmail); + if (message.minInstanceCount != null && Object.hasOwnProperty.call(message, "minInstanceCount")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.minInstanceCount); + if (message.availableMemory != null && Object.hasOwnProperty.call(message, "availableMemory")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.availableMemory); + if (message.allTrafficOnLatestRevision != null && Object.hasOwnProperty.call(message, "allTrafficOnLatestRevision")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.allTrafficOnLatestRevision); + if (message.secretEnvironmentVariables != null && message.secretEnvironmentVariables.length) + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) + $root.google.cloud.functions.v2alpha.SecretEnvVar.encode(message.secretEnvironmentVariables[i], writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.revision); + if (message.secretVolumes != null && message.secretVolumes.length) + for (var i = 0; i < message.secretVolumes.length; ++i) + $root.google.cloud.functions.v2alpha.SecretVolume.encode(message.secretVolumes[i], writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ServiceConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {google.cloud.functions.v2alpha.IServiceConfig} message ServiceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.ServiceConfig} ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.ServiceConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.service = reader.string(); + break; + case 2: + message.timeoutSeconds = reader.int32(); + break; + case 13: + message.availableMemory = reader.string(); + break; + case 4: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.environmentVariables[key] = value; + break; + case 5: + message.maxInstanceCount = reader.int32(); + break; + case 12: + message.minInstanceCount = reader.int32(); + break; + case 6: + message.vpcConnector = reader.string(); + break; + case 7: + message.vpcConnectorEgressSettings = reader.int32(); + break; + case 8: + message.ingressSettings = reader.int32(); + break; + case 9: + message.uri = reader.string(); + break; + case 10: + message.serviceAccountEmail = reader.string(); + break; + case 16: + message.allTrafficOnLatestRevision = reader.bool(); + break; + case 17: + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v2alpha.SecretEnvVar.decode(reader, reader.uint32())); + break; + case 19: + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v2alpha.SecretVolume.decode(reader, reader.uint32())); + break; + case 18: + message.revision = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.ServiceConfig} ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceConfig message. + * @function verify + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.timeoutSeconds != null && message.hasOwnProperty("timeoutSeconds")) + if (!$util.isInteger(message.timeoutSeconds)) + return "timeoutSeconds: integer expected"; + if (message.availableMemory != null && message.hasOwnProperty("availableMemory")) + if (!$util.isString(message.availableMemory)) + return "availableMemory: string expected"; + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.maxInstanceCount != null && message.hasOwnProperty("maxInstanceCount")) + if (!$util.isInteger(message.maxInstanceCount)) + return "maxInstanceCount: integer expected"; + if (message.minInstanceCount != null && message.hasOwnProperty("minInstanceCount")) + if (!$util.isInteger(message.minInstanceCount)) + return "minInstanceCount: integer expected"; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + if (!$util.isString(message.vpcConnector)) + return "vpcConnector: string expected"; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + switch (message.vpcConnectorEgressSettings) { + default: + return "vpcConnectorEgressSettings: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + switch (message.ingressSettings) { + default: + return "ingressSettings: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.allTrafficOnLatestRevision != null && message.hasOwnProperty("allTrafficOnLatestRevision")) + if (typeof message.allTrafficOnLatestRevision !== "boolean") + return "allTrafficOnLatestRevision: boolean expected"; + if (message.secretEnvironmentVariables != null && message.hasOwnProperty("secretEnvironmentVariables")) { + if (!Array.isArray(message.secretEnvironmentVariables)) + return "secretEnvironmentVariables: array expected"; + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.SecretEnvVar.verify(message.secretEnvironmentVariables[i]); + if (error) + return "secretEnvironmentVariables." + error; + } + } + if (message.secretVolumes != null && message.hasOwnProperty("secretVolumes")) { + if (!Array.isArray(message.secretVolumes)) + return "secretVolumes: array expected"; + for (var i = 0; i < message.secretVolumes.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.SecretVolume.verify(message.secretVolumes[i]); + if (error) + return "secretVolumes." + error; + } + } + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isString(message.revision)) + return "revision: string expected"; + return null; + }; + + /** + * Creates a ServiceConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.ServiceConfig} ServiceConfig + */ + ServiceConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.ServiceConfig) + return object; + var message = new $root.google.cloud.functions.v2alpha.ServiceConfig(); + if (object.service != null) + message.service = String(object.service); + if (object.timeoutSeconds != null) + message.timeoutSeconds = object.timeoutSeconds | 0; + if (object.availableMemory != null) + message.availableMemory = String(object.availableMemory); + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v2alpha.ServiceConfig.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.maxInstanceCount != null) + message.maxInstanceCount = object.maxInstanceCount | 0; + if (object.minInstanceCount != null) + message.minInstanceCount = object.minInstanceCount | 0; + if (object.vpcConnector != null) + message.vpcConnector = String(object.vpcConnector); + switch (object.vpcConnectorEgressSettings) { + case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.vpcConnectorEgressSettings = 0; + break; + case "PRIVATE_RANGES_ONLY": + case 1: + message.vpcConnectorEgressSettings = 1; + break; + case "ALL_TRAFFIC": + case 2: + message.vpcConnectorEgressSettings = 2; + break; + } + switch (object.ingressSettings) { + case "INGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.ingressSettings = 0; + break; + case "ALLOW_ALL": + case 1: + message.ingressSettings = 1; + break; + case "ALLOW_INTERNAL_ONLY": + case 2: + message.ingressSettings = 2; + break; + case "ALLOW_INTERNAL_AND_GCLB": + case 3: + message.ingressSettings = 3; + break; + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + if (object.allTrafficOnLatestRevision != null) + message.allTrafficOnLatestRevision = Boolean(object.allTrafficOnLatestRevision); + if (object.secretEnvironmentVariables) { + if (!Array.isArray(object.secretEnvironmentVariables)) + throw TypeError(".google.cloud.functions.v2alpha.ServiceConfig.secretEnvironmentVariables: array expected"); + message.secretEnvironmentVariables = []; + for (var i = 0; i < object.secretEnvironmentVariables.length; ++i) { + if (typeof object.secretEnvironmentVariables[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.ServiceConfig.secretEnvironmentVariables: object expected"); + message.secretEnvironmentVariables[i] = $root.google.cloud.functions.v2alpha.SecretEnvVar.fromObject(object.secretEnvironmentVariables[i]); + } + } + if (object.secretVolumes) { + if (!Array.isArray(object.secretVolumes)) + throw TypeError(".google.cloud.functions.v2alpha.ServiceConfig.secretVolumes: array expected"); + message.secretVolumes = []; + for (var i = 0; i < object.secretVolumes.length; ++i) { + if (typeof object.secretVolumes[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.ServiceConfig.secretVolumes: object expected"); + message.secretVolumes[i] = $root.google.cloud.functions.v2alpha.SecretVolume.fromObject(object.secretVolumes[i]); + } + } + if (object.revision != null) + message.revision = String(object.revision); + return message; + }; + + /** + * Creates a plain object from a ServiceConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {google.cloud.functions.v2alpha.ServiceConfig} message ServiceConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.secretEnvironmentVariables = []; + object.secretVolumes = []; + } + if (options.objects || options.defaults) + object.environmentVariables = {}; + if (options.defaults) { + object.service = ""; + object.timeoutSeconds = 0; + object.maxInstanceCount = 0; + object.vpcConnector = ""; + object.vpcConnectorEgressSettings = options.enums === String ? "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" : 0; + object.ingressSettings = options.enums === String ? "INGRESS_SETTINGS_UNSPECIFIED" : 0; + object.uri = ""; + object.serviceAccountEmail = ""; + object.minInstanceCount = 0; + object.availableMemory = ""; + object.allTrafficOnLatestRevision = false; + object.revision = ""; + } + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.timeoutSeconds != null && message.hasOwnProperty("timeoutSeconds")) + object.timeoutSeconds = message.timeoutSeconds; + var keys2; + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.maxInstanceCount != null && message.hasOwnProperty("maxInstanceCount")) + object.maxInstanceCount = message.maxInstanceCount; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + object.vpcConnector = message.vpcConnector; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2alpha.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.minInstanceCount != null && message.hasOwnProperty("minInstanceCount")) + object.minInstanceCount = message.minInstanceCount; + if (message.availableMemory != null && message.hasOwnProperty("availableMemory")) + object.availableMemory = message.availableMemory; + if (message.allTrafficOnLatestRevision != null && message.hasOwnProperty("allTrafficOnLatestRevision")) + object.allTrafficOnLatestRevision = message.allTrafficOnLatestRevision; + if (message.secretEnvironmentVariables && message.secretEnvironmentVariables.length) { + object.secretEnvironmentVariables = []; + for (var j = 0; j < message.secretEnvironmentVariables.length; ++j) + object.secretEnvironmentVariables[j] = $root.google.cloud.functions.v2alpha.SecretEnvVar.toObject(message.secretEnvironmentVariables[j], options); + } + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.secretVolumes && message.secretVolumes.length) { + object.secretVolumes = []; + for (var j = 0; j < message.secretVolumes.length; ++j) + object.secretVolumes[j] = $root.google.cloud.functions.v2alpha.SecretVolume.toObject(message.secretVolumes[j], options); + } + return object; + }; + + /** + * Converts this ServiceConfig to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @instance + * @returns {Object.} JSON object + */ + ServiceConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * VpcConnectorEgressSettings enum. + * @name google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings + * @enum {number} + * @property {number} VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED=0 VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED value + * @property {number} PRIVATE_RANGES_ONLY=1 PRIVATE_RANGES_ONLY value + * @property {number} ALL_TRAFFIC=2 ALL_TRAFFIC value + */ + ServiceConfig.VpcConnectorEgressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIVATE_RANGES_ONLY"] = 1; + values[valuesById[2] = "ALL_TRAFFIC"] = 2; + return values; + })(); + + /** + * IngressSettings enum. + * @name google.cloud.functions.v2alpha.ServiceConfig.IngressSettings + * @enum {number} + * @property {number} INGRESS_SETTINGS_UNSPECIFIED=0 INGRESS_SETTINGS_UNSPECIFIED value + * @property {number} ALLOW_ALL=1 ALLOW_ALL value + * @property {number} ALLOW_INTERNAL_ONLY=2 ALLOW_INTERNAL_ONLY value + * @property {number} ALLOW_INTERNAL_AND_GCLB=3 ALLOW_INTERNAL_AND_GCLB value + */ + ServiceConfig.IngressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALLOW_ALL"] = 1; + values[valuesById[2] = "ALLOW_INTERNAL_ONLY"] = 2; + values[valuesById[3] = "ALLOW_INTERNAL_AND_GCLB"] = 3; + return values; + })(); + + return ServiceConfig; + })(); + + v2alpha.SecretEnvVar = (function() { + + /** + * Properties of a SecretEnvVar. + * @memberof google.cloud.functions.v2alpha + * @interface ISecretEnvVar + * @property {string|null} [key] SecretEnvVar key + * @property {string|null} [projectId] SecretEnvVar projectId + * @property {string|null} [secret] SecretEnvVar secret + * @property {string|null} [version] SecretEnvVar version + */ + + /** + * Constructs a new SecretEnvVar. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a SecretEnvVar. + * @implements ISecretEnvVar + * @constructor + * @param {google.cloud.functions.v2alpha.ISecretEnvVar=} [properties] Properties to set + */ + function SecretEnvVar(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretEnvVar key. + * @member {string} key + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.key = ""; + + /** + * SecretEnvVar projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.projectId = ""; + + /** + * SecretEnvVar secret. + * @member {string} secret + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.secret = ""; + + /** + * SecretEnvVar version. + * @member {string} version + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.version = ""; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {google.cloud.functions.v2alpha.ISecretEnvVar=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.SecretEnvVar} SecretEnvVar instance + */ + SecretEnvVar.create = function create(properties) { + return new SecretEnvVar(properties); + }; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v2alpha.SecretEnvVar.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {google.cloud.functions.v2alpha.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.version); + return writer; + }; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.SecretEnvVar.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {google.cloud.functions.v2alpha.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.SecretEnvVar(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretEnvVar message. + * @function verify + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretEnvVar.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.SecretEnvVar} SecretEnvVar + */ + SecretEnvVar.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.SecretEnvVar) + return object; + var message = new $root.google.cloud.functions.v2alpha.SecretEnvVar(); + if (object.key != null) + message.key = String(object.key); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {google.cloud.functions.v2alpha.SecretEnvVar} message SecretEnvVar + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretEnvVar.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = ""; + object.projectId = ""; + object.secret = ""; + object.version = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this SecretEnvVar to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @instance + * @returns {Object.} JSON object + */ + SecretEnvVar.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecretEnvVar; + })(); + + v2alpha.SecretVolume = (function() { + + /** + * Properties of a SecretVolume. + * @memberof google.cloud.functions.v2alpha + * @interface ISecretVolume + * @property {string|null} [mountPath] SecretVolume mountPath + * @property {string|null} [projectId] SecretVolume projectId + * @property {string|null} [secret] SecretVolume secret + * @property {Array.|null} [versions] SecretVolume versions + */ + + /** + * Constructs a new SecretVolume. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a SecretVolume. + * @implements ISecretVolume + * @constructor + * @param {google.cloud.functions.v2alpha.ISecretVolume=} [properties] Properties to set + */ + function SecretVolume(properties) { + this.versions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretVolume mountPath. + * @member {string} mountPath + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @instance + */ + SecretVolume.prototype.mountPath = ""; + + /** + * SecretVolume projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @instance + */ + SecretVolume.prototype.projectId = ""; + + /** + * SecretVolume secret. + * @member {string} secret + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @instance + */ + SecretVolume.prototype.secret = ""; + + /** + * SecretVolume versions. + * @member {Array.} versions + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @instance + */ + SecretVolume.prototype.versions = $util.emptyArray; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {google.cloud.functions.v2alpha.ISecretVolume=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.SecretVolume} SecretVolume instance + */ + SecretVolume.create = function create(properties) { + return new SecretVolume(properties); + }; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v2alpha.SecretVolume.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {google.cloud.functions.v2alpha.ISecretVolume} message SecretVolume message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVolume.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mountPath != null && Object.hasOwnProperty.call(message, "mountPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mountPath); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion.encode(message.versions[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.SecretVolume.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {google.cloud.functions.v2alpha.ISecretVolume} message SecretVolume message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVolume.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.SecretVolume} SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVolume.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.SecretVolume(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mountPath = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.SecretVolume} SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVolume.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretVolume message. + * @function verify + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretVolume.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + if (!$util.isString(message.mountPath)) + return "mountPath: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + return null; + }; + + /** + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.SecretVolume} SecretVolume + */ + SecretVolume.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.SecretVolume) + return object; + var message = new $root.google.cloud.functions.v2alpha.SecretVolume(); + if (object.mountPath != null) + message.mountPath = String(object.mountPath); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".google.cloud.functions.v2alpha.SecretVolume.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.SecretVolume.versions: object expected"); + message.versions[i] = $root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion.fromObject(object.versions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {google.cloud.functions.v2alpha.SecretVolume} message SecretVolume + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretVolume.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) { + object.mountPath = ""; + object.projectId = ""; + object.secret = ""; + } + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + object.mountPath = message.mountPath; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion.toObject(message.versions[j], options); + } + return object; + }; + + /** + * Converts this SecretVolume to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @instance + * @returns {Object.} JSON object + */ + SecretVolume.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SecretVolume.SecretVersion = (function() { + + /** + * Properties of a SecretVersion. + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @interface ISecretVersion + * @property {string|null} [version] SecretVersion version + * @property {string|null} [path] SecretVersion path + */ + + /** + * Constructs a new SecretVersion. + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @classdesc Represents a SecretVersion. + * @implements ISecretVersion + * @constructor + * @param {google.cloud.functions.v2alpha.SecretVolume.ISecretVersion=} [properties] Properties to set + */ + function SecretVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretVersion version. + * @member {string} version + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.version = ""; + + /** + * SecretVersion path. + * @member {string} path + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.path = ""; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2alpha.SecretVolume.ISecretVersion=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.SecretVolume.SecretVersion} SecretVersion instance + */ + SecretVersion.create = function create(properties) { + return new SecretVersion(properties); + }; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v2alpha.SecretVolume.SecretVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2alpha.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.SecretVolume.SecretVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2alpha.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.SecretVolume.SecretVersion} SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.SecretVolume.SecretVersion} SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretVersion message. + * @function verify + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.SecretVolume.SecretVersion} SecretVersion + */ + SecretVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion) + return object; + var message = new $root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion(); + if (object.version != null) + message.version = String(object.version); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2alpha.SecretVolume.SecretVersion} message SecretVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = ""; + object.path = ""; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this SecretVersion to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @instance + * @returns {Object.} JSON object + */ + SecretVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecretVersion; + })(); + + return SecretVolume; + })(); + + v2alpha.EventTrigger = (function() { + + /** + * Properties of an EventTrigger. + * @memberof google.cloud.functions.v2alpha + * @interface IEventTrigger + * @property {string|null} [trigger] EventTrigger trigger + * @property {string|null} [triggerRegion] EventTrigger triggerRegion + * @property {string|null} [eventType] EventTrigger eventType + * @property {Array.|null} [eventFilters] EventTrigger eventFilters + * @property {string|null} [pubsubTopic] EventTrigger pubsubTopic + * @property {string|null} [serviceAccountEmail] EventTrigger serviceAccountEmail + * @property {google.cloud.functions.v2alpha.EventTrigger.RetryPolicy|null} [retryPolicy] EventTrigger retryPolicy + * @property {string|null} [channel] EventTrigger channel + */ + + /** + * Constructs a new EventTrigger. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents an EventTrigger. + * @implements IEventTrigger + * @constructor + * @param {google.cloud.functions.v2alpha.IEventTrigger=} [properties] Properties to set + */ + function EventTrigger(properties) { + this.eventFilters = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventTrigger trigger. + * @member {string} trigger + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + */ + EventTrigger.prototype.trigger = ""; + + /** + * EventTrigger triggerRegion. + * @member {string} triggerRegion + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + */ + EventTrigger.prototype.triggerRegion = ""; + + /** + * EventTrigger eventType. + * @member {string} eventType + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + */ + EventTrigger.prototype.eventType = ""; + + /** + * EventTrigger eventFilters. + * @member {Array.} eventFilters + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + */ + EventTrigger.prototype.eventFilters = $util.emptyArray; + + /** + * EventTrigger pubsubTopic. + * @member {string} pubsubTopic + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + */ + EventTrigger.prototype.pubsubTopic = ""; + + /** + * EventTrigger serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + */ + EventTrigger.prototype.serviceAccountEmail = ""; + + /** + * EventTrigger retryPolicy. + * @member {google.cloud.functions.v2alpha.EventTrigger.RetryPolicy} retryPolicy + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + */ + EventTrigger.prototype.retryPolicy = 0; + + /** + * EventTrigger channel. + * @member {string} channel + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + */ + EventTrigger.prototype.channel = ""; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {google.cloud.functions.v2alpha.IEventTrigger=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.EventTrigger} EventTrigger instance + */ + EventTrigger.create = function create(properties) { + return new EventTrigger(properties); + }; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v2alpha.EventTrigger.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {google.cloud.functions.v2alpha.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.trigger); + if (message.triggerRegion != null && Object.hasOwnProperty.call(message, "triggerRegion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerRegion); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.eventType); + if (message.eventFilters != null && message.eventFilters.length) + for (var i = 0; i < message.eventFilters.length; ++i) + $root.google.cloud.functions.v2alpha.EventFilter.encode(message.eventFilters[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pubsubTopic != null && Object.hasOwnProperty.call(message, "pubsubTopic")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pubsubTopic); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.serviceAccountEmail); + if (message.retryPolicy != null && Object.hasOwnProperty.call(message, "retryPolicy")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.retryPolicy); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.channel); + return writer; + }; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.EventTrigger.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {google.cloud.functions.v2alpha.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.EventTrigger(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.trigger = reader.string(); + break; + case 2: + message.triggerRegion = reader.string(); + break; + case 3: + message.eventType = reader.string(); + break; + case 4: + if (!(message.eventFilters && message.eventFilters.length)) + message.eventFilters = []; + message.eventFilters.push($root.google.cloud.functions.v2alpha.EventFilter.decode(reader, reader.uint32())); + break; + case 5: + message.pubsubTopic = reader.string(); + break; + case 6: + message.serviceAccountEmail = reader.string(); + break; + case 7: + message.retryPolicy = reader.int32(); + break; + case 8: + message.channel = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventTrigger message. + * @function verify + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventTrigger.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) + if (!$util.isString(message.trigger)) + return "trigger: string expected"; + if (message.triggerRegion != null && message.hasOwnProperty("triggerRegion")) + if (!$util.isString(message.triggerRegion)) + return "triggerRegion: string expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.eventFilters != null && message.hasOwnProperty("eventFilters")) { + if (!Array.isArray(message.eventFilters)) + return "eventFilters: array expected"; + for (var i = 0; i < message.eventFilters.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.EventFilter.verify(message.eventFilters[i]); + if (error) + return "eventFilters." + error; + } + } + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) + if (!$util.isString(message.pubsubTopic)) + return "pubsubTopic: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) + switch (message.retryPolicy) { + default: + return "retryPolicy: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.channel != null && message.hasOwnProperty("channel")) + if (!$util.isString(message.channel)) + return "channel: string expected"; + return null; + }; + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.EventTrigger} EventTrigger + */ + EventTrigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.EventTrigger) + return object; + var message = new $root.google.cloud.functions.v2alpha.EventTrigger(); + if (object.trigger != null) + message.trigger = String(object.trigger); + if (object.triggerRegion != null) + message.triggerRegion = String(object.triggerRegion); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.eventFilters) { + if (!Array.isArray(object.eventFilters)) + throw TypeError(".google.cloud.functions.v2alpha.EventTrigger.eventFilters: array expected"); + message.eventFilters = []; + for (var i = 0; i < object.eventFilters.length; ++i) { + if (typeof object.eventFilters[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.EventTrigger.eventFilters: object expected"); + message.eventFilters[i] = $root.google.cloud.functions.v2alpha.EventFilter.fromObject(object.eventFilters[i]); + } + } + if (object.pubsubTopic != null) + message.pubsubTopic = String(object.pubsubTopic); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + switch (object.retryPolicy) { + case "RETRY_POLICY_UNSPECIFIED": + case 0: + message.retryPolicy = 0; + break; + case "RETRY_POLICY_DO_NOT_RETRY": + case 1: + message.retryPolicy = 1; + break; + case "RETRY_POLICY_RETRY": + case 2: + message.retryPolicy = 2; + break; + } + if (object.channel != null) + message.channel = String(object.channel); + return message; + }; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {google.cloud.functions.v2alpha.EventTrigger} message EventTrigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventTrigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.eventFilters = []; + if (options.defaults) { + object.trigger = ""; + object.triggerRegion = ""; + object.eventType = ""; + object.pubsubTopic = ""; + object.serviceAccountEmail = ""; + object.retryPolicy = options.enums === String ? "RETRY_POLICY_UNSPECIFIED" : 0; + object.channel = ""; + } + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = message.trigger; + if (message.triggerRegion != null && message.hasOwnProperty("triggerRegion")) + object.triggerRegion = message.triggerRegion; + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.eventFilters && message.eventFilters.length) { + object.eventFilters = []; + for (var j = 0; j < message.eventFilters.length; ++j) + object.eventFilters[j] = $root.google.cloud.functions.v2alpha.EventFilter.toObject(message.eventFilters[j], options); + } + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) + object.pubsubTopic = message.pubsubTopic; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) + object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2alpha.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = message.channel; + return object; + }; + + /** + * Converts this EventTrigger to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @instance + * @returns {Object.} JSON object + */ + EventTrigger.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * RetryPolicy enum. + * @name google.cloud.functions.v2alpha.EventTrigger.RetryPolicy + * @enum {number} + * @property {number} RETRY_POLICY_UNSPECIFIED=0 RETRY_POLICY_UNSPECIFIED value + * @property {number} RETRY_POLICY_DO_NOT_RETRY=1 RETRY_POLICY_DO_NOT_RETRY value + * @property {number} RETRY_POLICY_RETRY=2 RETRY_POLICY_RETRY value + */ + EventTrigger.RetryPolicy = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETRY_POLICY_UNSPECIFIED"] = 0; + values[valuesById[1] = "RETRY_POLICY_DO_NOT_RETRY"] = 1; + values[valuesById[2] = "RETRY_POLICY_RETRY"] = 2; + return values; + })(); + + return EventTrigger; + })(); + + v2alpha.EventFilter = (function() { + + /** + * Properties of an EventFilter. + * @memberof google.cloud.functions.v2alpha + * @interface IEventFilter + * @property {string|null} [attribute] EventFilter attribute + * @property {string|null} [value] EventFilter value + * @property {string|null} [operator] EventFilter operator + */ + + /** + * Constructs a new EventFilter. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents an EventFilter. + * @implements IEventFilter + * @constructor + * @param {google.cloud.functions.v2alpha.IEventFilter=} [properties] Properties to set + */ + function EventFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventFilter attribute. + * @member {string} attribute + * @memberof google.cloud.functions.v2alpha.EventFilter + * @instance + */ + EventFilter.prototype.attribute = ""; + + /** + * EventFilter value. + * @member {string} value + * @memberof google.cloud.functions.v2alpha.EventFilter + * @instance + */ + EventFilter.prototype.value = ""; + + /** + * EventFilter operator. + * @member {string} operator + * @memberof google.cloud.functions.v2alpha.EventFilter + * @instance + */ + EventFilter.prototype.operator = ""; + + /** + * Creates a new EventFilter instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {google.cloud.functions.v2alpha.IEventFilter=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.EventFilter} EventFilter instance + */ + EventFilter.create = function create(properties) { + return new EventFilter(properties); + }; + + /** + * Encodes the specified EventFilter message. Does not implicitly {@link google.cloud.functions.v2alpha.EventFilter.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {google.cloud.functions.v2alpha.IEventFilter} message EventFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventFilter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attribute != null && Object.hasOwnProperty.call(message, "attribute")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attribute); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.operator != null && Object.hasOwnProperty.call(message, "operator")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.operator); + return writer; + }; + + /** + * Encodes the specified EventFilter message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.EventFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {google.cloud.functions.v2alpha.IEventFilter} message EventFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventFilter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.EventFilter} EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventFilter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.EventFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attribute = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + case 3: + message.operator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.EventFilter} EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventFilter message. + * @function verify + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventFilter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attribute != null && message.hasOwnProperty("attribute")) + if (!$util.isString(message.attribute)) + return "attribute: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.operator != null && message.hasOwnProperty("operator")) + if (!$util.isString(message.operator)) + return "operator: string expected"; + return null; + }; + + /** + * Creates an EventFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.EventFilter} EventFilter + */ + EventFilter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.EventFilter) + return object; + var message = new $root.google.cloud.functions.v2alpha.EventFilter(); + if (object.attribute != null) + message.attribute = String(object.attribute); + if (object.value != null) + message.value = String(object.value); + if (object.operator != null) + message.operator = String(object.operator); + return message; + }; + + /** + * Creates a plain object from an EventFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {google.cloud.functions.v2alpha.EventFilter} message EventFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventFilter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attribute = ""; + object.value = ""; + object.operator = ""; + } + if (message.attribute != null && message.hasOwnProperty("attribute")) + object.attribute = message.attribute; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.operator != null && message.hasOwnProperty("operator")) + object.operator = message.operator; + return object; + }; + + /** + * Converts this EventFilter to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.EventFilter + * @instance + * @returns {Object.} JSON object + */ + EventFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventFilter; + })(); + + v2alpha.GetFunctionRequest = (function() { + + /** + * Properties of a GetFunctionRequest. + * @memberof google.cloud.functions.v2alpha + * @interface IGetFunctionRequest + * @property {string|null} [name] GetFunctionRequest name + */ + + /** + * Constructs a new GetFunctionRequest. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a GetFunctionRequest. + * @implements IGetFunctionRequest + * @constructor + * @param {google.cloud.functions.v2alpha.IGetFunctionRequest=} [properties] Properties to set + */ + function GetFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @instance + */ + GetFunctionRequest.prototype.name = ""; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IGetFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.GetFunctionRequest} GetFunctionRequest instance + */ + GetFunctionRequest.create = function create(properties) { + return new GetFunctionRequest(properties); + }; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.GetFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GetFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.GetFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.GetFunctionRequest} GetFunctionRequest + */ + GetFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.GetFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2alpha.GetFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.GetFunctionRequest} message GetFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + GetFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetFunctionRequest; + })(); + + v2alpha.ListFunctionsRequest = (function() { + + /** + * Properties of a ListFunctionsRequest. + * @memberof google.cloud.functions.v2alpha + * @interface IListFunctionsRequest + * @property {string|null} [parent] ListFunctionsRequest parent + * @property {number|null} [pageSize] ListFunctionsRequest pageSize + * @property {string|null} [pageToken] ListFunctionsRequest pageToken + * @property {string|null} [filter] ListFunctionsRequest filter + * @property {string|null} [orderBy] ListFunctionsRequest orderBy + */ + + /** + * Constructs a new ListFunctionsRequest. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a ListFunctionsRequest. + * @implements IListFunctionsRequest + * @constructor + * @param {google.cloud.functions.v2alpha.IListFunctionsRequest=} [properties] Properties to set + */ + function ListFunctionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFunctionsRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.parent = ""; + + /** + * ListFunctionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageSize = 0; + + /** + * ListFunctionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageToken = ""; + + /** + * ListFunctionsRequest filter. + * @member {string} filter + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.filter = ""; + + /** + * ListFunctionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2alpha.IListFunctionsRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.ListFunctionsRequest} ListFunctionsRequest instance + */ + ListFunctionsRequest.create = function create(properties) { + return new ListFunctionsRequest(properties); + }; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.ListFunctionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2alpha.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListFunctionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2alpha.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.ListFunctionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + case 5: + message.orderBy = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsRequest message. + * @function verify + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.ListFunctionsRequest} ListFunctionsRequest + */ + ListFunctionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.ListFunctionsRequest) + return object; + var message = new $root.google.cloud.functions.v2alpha.ListFunctionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2alpha.ListFunctionsRequest} message ListFunctionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsRequest; + })(); + + v2alpha.ListFunctionsResponse = (function() { + + /** + * Properties of a ListFunctionsResponse. + * @memberof google.cloud.functions.v2alpha + * @interface IListFunctionsResponse + * @property {Array.|null} [functions] ListFunctionsResponse functions + * @property {string|null} [nextPageToken] ListFunctionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListFunctionsResponse unreachable + */ + + /** + * Constructs a new ListFunctionsResponse. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a ListFunctionsResponse. + * @implements IListFunctionsResponse + * @constructor + * @param {google.cloud.functions.v2alpha.IListFunctionsResponse=} [properties] Properties to set + */ + function ListFunctionsResponse(properties) { + this.functions = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFunctionsResponse functions. + * @member {Array.} functions + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.functions = $util.emptyArray; + + /** + * ListFunctionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.nextPageToken = ""; + + /** + * ListFunctionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2alpha.IListFunctionsResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.ListFunctionsResponse} ListFunctionsResponse instance + */ + ListFunctionsResponse.create = function create(properties) { + return new ListFunctionsResponse(properties); + }; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v2alpha.ListFunctionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2alpha.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.functions != null && message.functions.length) + for (var i = 0; i < message.functions.length; ++i) + $root.google.cloud.functions.v2alpha.Function.encode(message.functions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListFunctionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2alpha.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.ListFunctionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsResponse message. + * @function verify + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.functions != null && message.hasOwnProperty("functions")) { + if (!Array.isArray(message.functions)) + return "functions: array expected"; + for (var i = 0; i < message.functions.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.Function.verify(message.functions[i]); + if (error) + return "functions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.ListFunctionsResponse} ListFunctionsResponse + */ + ListFunctionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.ListFunctionsResponse) + return object; + var message = new $root.google.cloud.functions.v2alpha.ListFunctionsResponse(); + if (object.functions) { + if (!Array.isArray(object.functions)) + throw TypeError(".google.cloud.functions.v2alpha.ListFunctionsResponse.functions: array expected"); + message.functions = []; + for (var i = 0; i < object.functions.length; ++i) { + if (typeof object.functions[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.ListFunctionsResponse.functions: object expected"); + message.functions[i] = $root.google.cloud.functions.v2alpha.Function.fromObject(object.functions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.functions.v2alpha.ListFunctionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2alpha.ListFunctionsResponse} message ListFunctionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.functions = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.functions && message.functions.length) { + object.functions = []; + for (var j = 0; j < message.functions.length; ++j) + object.functions[j] = $root.google.cloud.functions.v2alpha.Function.toObject(message.functions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsResponse; + })(); + + v2alpha.CreateFunctionRequest = (function() { + + /** + * Properties of a CreateFunctionRequest. + * @memberof google.cloud.functions.v2alpha + * @interface ICreateFunctionRequest + * @property {string|null} [parent] CreateFunctionRequest parent + * @property {google.cloud.functions.v2alpha.IFunction|null} ["function"] CreateFunctionRequest function + * @property {string|null} [functionId] CreateFunctionRequest functionId + */ + + /** + * Constructs a new CreateFunctionRequest. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a CreateFunctionRequest. + * @implements ICreateFunctionRequest + * @constructor + * @param {google.cloud.functions.v2alpha.ICreateFunctionRequest=} [properties] Properties to set + */ + function CreateFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateFunctionRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.parent = ""; + + /** + * CreateFunctionRequest function. + * @member {google.cloud.functions.v2alpha.IFunction|null|undefined} function + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype["function"] = null; + + /** + * CreateFunctionRequest functionId. + * @member {string} functionId + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.functionId = ""; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.ICreateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.CreateFunctionRequest} CreateFunctionRequest instance + */ + CreateFunctionRequest.create = function create(properties) { + return new CreateFunctionRequest(properties); + }; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.CreateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v2alpha.Function.encode(message["function"], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.functionId != null && Object.hasOwnProperty.call(message, "functionId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.functionId); + return writer; + }; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.CreateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.CreateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message["function"] = $root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32()); + break; + case 3: + message.functionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v2alpha.Function.verify(message["function"]); + if (error) + return "function." + error; + } + if (message.functionId != null && message.hasOwnProperty("functionId")) + if (!$util.isString(message.functionId)) + return "functionId: string expected"; + return null; + }; + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.CreateFunctionRequest} CreateFunctionRequest + */ + CreateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.CreateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2alpha.CreateFunctionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.CreateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v2alpha.Function.fromObject(object["function"]); + } + if (object.functionId != null) + message.functionId = String(object.functionId); + return message; + }; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.CreateFunctionRequest} message CreateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object["function"] = null; + object.functionId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v2alpha.Function.toObject(message["function"], options); + if (message.functionId != null && message.hasOwnProperty("functionId")) + object.functionId = message.functionId; + return object; + }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateFunctionRequest; + })(); + + v2alpha.UpdateFunctionRequest = (function() { + + /** + * Properties of an UpdateFunctionRequest. + * @memberof google.cloud.functions.v2alpha + * @interface IUpdateFunctionRequest + * @property {google.cloud.functions.v2alpha.IFunction|null} ["function"] UpdateFunctionRequest function + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFunctionRequest updateMask + */ + + /** + * Constructs a new UpdateFunctionRequest. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents an UpdateFunctionRequest. + * @implements IUpdateFunctionRequest + * @constructor + * @param {google.cloud.functions.v2alpha.IUpdateFunctionRequest=} [properties] Properties to set + */ + function UpdateFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateFunctionRequest function. + * @member {google.cloud.functions.v2alpha.IFunction|null|undefined} function + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype["function"] = null; + + /** + * UpdateFunctionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IUpdateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.UpdateFunctionRequest} UpdateFunctionRequest instance + */ + UpdateFunctionRequest.create = function create(properties) { + return new UpdateFunctionRequest(properties); + }; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.UpdateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v2alpha.Function.encode(message["function"], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.UpdateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.UpdateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["function"] = $root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v2alpha.Function.verify(message["function"]); + if (error) + return "function." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.UpdateFunctionRequest} UpdateFunctionRequest + */ + UpdateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.UpdateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2alpha.UpdateFunctionRequest(); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.UpdateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v2alpha.Function.fromObject(object["function"]); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.functions.v2alpha.UpdateFunctionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.UpdateFunctionRequest} message UpdateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object["function"] = null; + object.updateMask = null; + } + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v2alpha.Function.toObject(message["function"], options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateFunctionRequest; + })(); + + v2alpha.DeleteFunctionRequest = (function() { + + /** + * Properties of a DeleteFunctionRequest. + * @memberof google.cloud.functions.v2alpha + * @interface IDeleteFunctionRequest + * @property {string|null} [name] DeleteFunctionRequest name + */ + + /** + * Constructs a new DeleteFunctionRequest. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a DeleteFunctionRequest. + * @implements IDeleteFunctionRequest + * @constructor + * @param {google.cloud.functions.v2alpha.IDeleteFunctionRequest=} [properties] Properties to set + */ + function DeleteFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @instance + */ + DeleteFunctionRequest.prototype.name = ""; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IDeleteFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.DeleteFunctionRequest} DeleteFunctionRequest instance + */ + DeleteFunctionRequest.create = function create(properties) { + return new DeleteFunctionRequest(properties); + }; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.DeleteFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.DeleteFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.DeleteFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.DeleteFunctionRequest} DeleteFunctionRequest + */ + DeleteFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.DeleteFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2alpha.DeleteFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2alpha.DeleteFunctionRequest} message DeleteFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteFunctionRequest; + })(); + + v2alpha.GenerateUploadUrlRequest = (function() { + + /** + * Properties of a GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v2alpha + * @interface IGenerateUploadUrlRequest + * @property {string|null} [parent] GenerateUploadUrlRequest parent + */ + + /** + * Constructs a new GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a GenerateUploadUrlRequest. + * @implements IGenerateUploadUrlRequest + * @constructor + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlRequest=} [properties] Properties to set + */ + function GenerateUploadUrlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateUploadUrlRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @instance + */ + GenerateUploadUrlRequest.prototype.parent = ""; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.GenerateUploadUrlRequest} GenerateUploadUrlRequest instance + */ + GenerateUploadUrlRequest.create = function create(properties) { + return new GenerateUploadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateUploadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateUploadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.GenerateUploadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.GenerateUploadUrlRequest} GenerateUploadUrlRequest + */ + GenerateUploadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.GenerateUploadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v2alpha.GenerateUploadUrlRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2alpha.GenerateUploadUrlRequest} message GenerateUploadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlRequest; + })(); + + v2alpha.GenerateUploadUrlResponse = (function() { + + /** + * Properties of a GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v2alpha + * @interface IGenerateUploadUrlResponse + * @property {string|null} [uploadUrl] GenerateUploadUrlResponse uploadUrl + * @property {google.cloud.functions.v2alpha.IStorageSource|null} [storageSource] GenerateUploadUrlResponse storageSource + */ + + /** + * Constructs a new GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a GenerateUploadUrlResponse. + * @implements IGenerateUploadUrlResponse + * @constructor + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlResponse=} [properties] Properties to set + */ + function GenerateUploadUrlResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateUploadUrlResponse uploadUrl. + * @member {string} uploadUrl + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.uploadUrl = ""; + + /** + * GenerateUploadUrlResponse storageSource. + * @member {google.cloud.functions.v2alpha.IStorageSource|null|undefined} storageSource + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.storageSource = null; + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.GenerateUploadUrlResponse} GenerateUploadUrlResponse instance + */ + GenerateUploadUrlResponse.create = function create(properties) { + return new GenerateUploadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateUploadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uploadUrl != null && Object.hasOwnProperty.call(message, "uploadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uploadUrl); + if (message.storageSource != null && Object.hasOwnProperty.call(message, "storageSource")) + $root.google.cloud.functions.v2alpha.StorageSource.encode(message.storageSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateUploadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2alpha.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.GenerateUploadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uploadUrl = reader.string(); + break; + case 2: + message.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + if (!$util.isString(message.uploadUrl)) + return "uploadUrl: string expected"; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + var error = $root.google.cloud.functions.v2alpha.StorageSource.verify(message.storageSource); + if (error) + return "storageSource." + error; + } + return null; + }; + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.GenerateUploadUrlResponse} GenerateUploadUrlResponse + */ + GenerateUploadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.GenerateUploadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v2alpha.GenerateUploadUrlResponse(); + if (object.uploadUrl != null) + message.uploadUrl = String(object.uploadUrl); + if (object.storageSource != null) { + if (typeof object.storageSource !== "object") + throw TypeError(".google.cloud.functions.v2alpha.GenerateUploadUrlResponse.storageSource: object expected"); + message.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.fromObject(object.storageSource); + } + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2alpha.GenerateUploadUrlResponse} message GenerateUploadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uploadUrl = ""; + object.storageSource = null; + } + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + object.uploadUrl = message.uploadUrl; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) + object.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.toObject(message.storageSource, options); + return object; + }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlResponse; + })(); + + v2alpha.GenerateDownloadUrlRequest = (function() { + + /** + * Properties of a GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v2alpha + * @interface IGenerateDownloadUrlRequest + * @property {string|null} [name] GenerateDownloadUrlRequest name + */ + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a GenerateDownloadUrlRequest. + * @implements IGenerateDownloadUrlRequest + * @constructor + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest=} [properties] Properties to set + */ + function GenerateDownloadUrlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateDownloadUrlRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @instance + */ + GenerateDownloadUrlRequest.prototype.name = ""; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest instance + */ + GenerateDownloadUrlRequest.create = function create(properties) { + return new GenerateDownloadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + */ + GenerateDownloadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2alpha.GenerateDownloadUrlRequest} message GenerateDownloadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlRequest; + })(); + + v2alpha.GenerateDownloadUrlResponse = (function() { + + /** + * Properties of a GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v2alpha + * @interface IGenerateDownloadUrlResponse + * @property {string|null} [downloadUrl] GenerateDownloadUrlResponse downloadUrl + */ + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a GenerateDownloadUrlResponse. + * @implements IGenerateDownloadUrlResponse + * @constructor + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse=} [properties] Properties to set + */ + function GenerateDownloadUrlResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateDownloadUrlResponse downloadUrl. + * @member {string} downloadUrl + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @instance + */ + GenerateDownloadUrlResponse.prototype.downloadUrl = ""; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse instance + */ + GenerateDownloadUrlResponse.create = function create(properties) { + return new GenerateDownloadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.downloadUrl != null && Object.hasOwnProperty.call(message, "downloadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.downloadUrl); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.downloadUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + if (!$util.isString(message.downloadUrl)) + return "downloadUrl: string expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + */ + GenerateDownloadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse(); + if (object.downloadUrl != null) + message.downloadUrl = String(object.downloadUrl); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2alpha.GenerateDownloadUrlResponse} message GenerateDownloadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.downloadUrl = ""; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + object.downloadUrl = message.downloadUrl; + return object; + }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlResponse; + })(); + + v2alpha.ListRuntimesRequest = (function() { + + /** + * Properties of a ListRuntimesRequest. + * @memberof google.cloud.functions.v2alpha + * @interface IListRuntimesRequest + * @property {string|null} [parent] ListRuntimesRequest parent + * @property {string|null} [filter] ListRuntimesRequest filter + */ + + /** + * Constructs a new ListRuntimesRequest. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a ListRuntimesRequest. + * @implements IListRuntimesRequest + * @constructor + * @param {google.cloud.functions.v2alpha.IListRuntimesRequest=} [properties] Properties to set + */ + function ListRuntimesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRuntimesRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @instance + */ + ListRuntimesRequest.prototype.parent = ""; + + /** + * ListRuntimesRequest filter. + * @member {string} filter + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @instance + */ + ListRuntimesRequest.prototype.filter = ""; + + /** + * Creates a new ListRuntimesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2alpha.IListRuntimesRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.ListRuntimesRequest} ListRuntimesRequest instance + */ + ListRuntimesRequest.create = function create(properties) { + return new ListRuntimesRequest(properties); + }; + + /** + * Encodes the specified ListRuntimesRequest message. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2alpha.IListRuntimesRequest} message ListRuntimesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListRuntimesRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2alpha.IListRuntimesRequest} message ListRuntimesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.ListRuntimesRequest} ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.ListRuntimesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.ListRuntimesRequest} ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimesRequest message. + * @function verify + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListRuntimesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.ListRuntimesRequest} ListRuntimesRequest + */ + ListRuntimesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.ListRuntimesRequest) + return object; + var message = new $root.google.cloud.functions.v2alpha.ListRuntimesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListRuntimesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2alpha.ListRuntimesRequest} message ListRuntimesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListRuntimesRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @instance + * @returns {Object.} JSON object + */ + ListRuntimesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListRuntimesRequest; + })(); + + v2alpha.ListRuntimesResponse = (function() { + + /** + * Properties of a ListRuntimesResponse. + * @memberof google.cloud.functions.v2alpha + * @interface IListRuntimesResponse + * @property {Array.|null} [runtimes] ListRuntimesResponse runtimes + */ + + /** + * Constructs a new ListRuntimesResponse. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a ListRuntimesResponse. + * @implements IListRuntimesResponse + * @constructor + * @param {google.cloud.functions.v2alpha.IListRuntimesResponse=} [properties] Properties to set + */ + function ListRuntimesResponse(properties) { + this.runtimes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRuntimesResponse runtimes. + * @member {Array.} runtimes + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @instance + */ + ListRuntimesResponse.prototype.runtimes = $util.emptyArray; + + /** + * Creates a new ListRuntimesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2alpha.IListRuntimesResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.ListRuntimesResponse} ListRuntimesResponse instance + */ + ListRuntimesResponse.create = function create(properties) { + return new ListRuntimesResponse(properties); + }; + + /** + * Encodes the specified ListRuntimesResponse message. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2alpha.IListRuntimesResponse} message ListRuntimesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.runtimes != null && message.runtimes.length) + for (var i = 0; i < message.runtimes.length; ++i) + $root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.encode(message.runtimes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListRuntimesResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2alpha.IListRuntimesResponse} message ListRuntimesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.ListRuntimesResponse} ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.ListRuntimesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.runtimes && message.runtimes.length)) + message.runtimes = []; + message.runtimes.push($root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.ListRuntimesResponse} ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimesResponse message. + * @function verify + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.runtimes != null && message.hasOwnProperty("runtimes")) { + if (!Array.isArray(message.runtimes)) + return "runtimes: array expected"; + for (var i = 0; i < message.runtimes.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.verify(message.runtimes[i]); + if (error) + return "runtimes." + error; + } + } + return null; + }; + + /** + * Creates a ListRuntimesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.ListRuntimesResponse} ListRuntimesResponse + */ + ListRuntimesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.ListRuntimesResponse) + return object; + var message = new $root.google.cloud.functions.v2alpha.ListRuntimesResponse(); + if (object.runtimes) { + if (!Array.isArray(object.runtimes)) + throw TypeError(".google.cloud.functions.v2alpha.ListRuntimesResponse.runtimes: array expected"); + message.runtimes = []; + for (var i = 0; i < object.runtimes.length; ++i) { + if (typeof object.runtimes[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.ListRuntimesResponse.runtimes: object expected"); + message.runtimes[i] = $root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.fromObject(object.runtimes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListRuntimesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2alpha.ListRuntimesResponse} message ListRuntimesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.runtimes = []; + if (message.runtimes && message.runtimes.length) { + object.runtimes = []; + for (var j = 0; j < message.runtimes.length; ++j) + object.runtimes[j] = $root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.toObject(message.runtimes[j], options); + } + return object; + }; + + /** + * Converts this ListRuntimesResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @instance + * @returns {Object.} JSON object + */ + ListRuntimesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ListRuntimesResponse.Runtime = (function() { + + /** + * Properties of a Runtime. + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @interface IRuntime + * @property {string|null} [name] Runtime name + * @property {string|null} [displayName] Runtime displayName + * @property {google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage|null} [stage] Runtime stage + * @property {Array.|null} [warnings] Runtime warnings + * @property {google.cloud.functions.v2alpha.Environment|null} [environment] Runtime environment + */ + + /** + * Constructs a new Runtime. + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @classdesc Represents a Runtime. + * @implements IRuntime + * @constructor + * @param {google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime=} [properties] Properties to set + */ + function Runtime(properties) { + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Runtime name. + * @member {string} name + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.name = ""; + + /** + * Runtime displayName. + * @member {string} displayName + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.displayName = ""; + + /** + * Runtime stage. + * @member {google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage} stage + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.stage = 0; + + /** + * Runtime warnings. + * @member {Array.} warnings + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.warnings = $util.emptyArray; + + /** + * Runtime environment. + * @member {google.cloud.functions.v2alpha.Environment} environment + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.environment = 0; + + /** + * Creates a new Runtime instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime} Runtime instance + */ + Runtime.create = function create(properties) { + return new Runtime(properties); + }; + + /** + * Encodes the specified Runtime message. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime} message Runtime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Runtime.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.stage != null && Object.hasOwnProperty.call(message, "stage")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.stage); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.warnings[i]); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.environment); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.displayName); + return writer; + }; + + /** + * Encodes the specified Runtime message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2alpha.ListRuntimesResponse.IRuntime} message Runtime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Runtime.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Runtime message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime} Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Runtime.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 5: + message.displayName = reader.string(); + break; + case 2: + message.stage = reader.int32(); + break; + case 3: + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push(reader.string()); + break; + case 4: + message.environment = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Runtime message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime} Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Runtime.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Runtime message. + * @function verify + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Runtime.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.stage != null && message.hasOwnProperty("stage")) + switch (message.stage) { + default: + return "stage: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) + if (!$util.isString(message.warnings[i])) + return "warnings: string[] expected"; + } + if (message.environment != null && message.hasOwnProperty("environment")) + switch (message.environment) { + default: + return "environment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a Runtime message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime} Runtime + */ + Runtime.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime) + return object; + var message = new $root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.stage) { + case "RUNTIME_STAGE_UNSPECIFIED": + case 0: + message.stage = 0; + break; + case "DEVELOPMENT": + case 1: + message.stage = 1; + break; + case "ALPHA": + case 2: + message.stage = 2; + break; + case "BETA": + case 3: + message.stage = 3; + break; + case "GA": + case 4: + message.stage = 4; + break; + case "DEPRECATED": + case 5: + message.stage = 5; + break; + case "DECOMMISSIONED": + case 6: + message.stage = 6; + break; + } + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) + message.warnings[i] = String(object.warnings[i]); + } + switch (object.environment) { + case "ENVIRONMENT_UNSPECIFIED": + case 0: + message.environment = 0; + break; + case "GEN_1": + case 1: + message.environment = 1; + break; + case "GEN_2": + case 2: + message.environment = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a Runtime message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime} message Runtime + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Runtime.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.warnings = []; + if (options.defaults) { + object.name = ""; + object.stage = options.enums === String ? "RUNTIME_STAGE_UNSPECIFIED" : 0; + object.environment = options.enums === String ? "ENVIRONMENT_UNSPECIFIED" : 0; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.stage != null && message.hasOwnProperty("stage")) + object.stage = options.enums === String ? $root.google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = message.warnings[j]; + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = options.enums === String ? $root.google.cloud.functions.v2alpha.Environment[message.environment] : message.environment; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + return object; + }; + + /** + * Converts this Runtime to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @instance + * @returns {Object.} JSON object + */ + Runtime.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Runtime; + })(); + + /** + * RuntimeStage enum. + * @name google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage + * @enum {number} + * @property {number} RUNTIME_STAGE_UNSPECIFIED=0 RUNTIME_STAGE_UNSPECIFIED value + * @property {number} DEVELOPMENT=1 DEVELOPMENT value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + * @property {number} DECOMMISSIONED=6 DECOMMISSIONED value + */ + ListRuntimesResponse.RuntimeStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RUNTIME_STAGE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DEVELOPMENT"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + values[valuesById[6] = "DECOMMISSIONED"] = 6; + return values; + })(); + + return ListRuntimesResponse; + })(); + + v2alpha.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.functions.v2alpha + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [statusDetail] OperationMetadata statusDetail + * @property {boolean|null} [cancelRequested] OperationMetadata cancelRequested + * @property {string|null} [apiVersion] OperationMetadata apiVersion + * @property {google.protobuf.IAny|null} [requestResource] OperationMetadata requestResource + * @property {Array.|null} [stages] OperationMetadata stages + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.functions.v2alpha.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(properties) { + this.stages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata statusDetail. + * @member {string} statusDetail + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.statusDetail = ""; + + /** + * OperationMetadata cancelRequested. + * @member {boolean} cancelRequested + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.cancelRequested = false; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * OperationMetadata requestResource. + * @member {google.protobuf.IAny|null|undefined} requestResource + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.requestResource = null; + + /** + * OperationMetadata stages. + * @member {Array.} stages + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + */ + OperationMetadata.prototype.stages = $util.emptyArray; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {google.cloud.functions.v2alpha.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.functions.v2alpha.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {google.cloud.functions.v2alpha.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.statusDetail != null && Object.hasOwnProperty.call(message, "statusDetail")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusDetail); + if (message.cancelRequested != null && Object.hasOwnProperty.call(message, "cancelRequested")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.cancelRequested); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); + if (message.requestResource != null && Object.hasOwnProperty.call(message, "requestResource")) + $root.google.protobuf.Any.encode(message.requestResource, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.stages != null && message.stages.length) + for (var i = 0; i < message.stages.length; ++i) + $root.google.cloud.functions.v2alpha.Stage.encode(message.stages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {google.cloud.functions.v2alpha.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.target = reader.string(); + break; + case 4: + message.verb = reader.string(); + break; + case 5: + message.statusDetail = reader.string(); + break; + case 6: + message.cancelRequested = reader.bool(); + break; + case 7: + message.apiVersion = reader.string(); + break; + case 8: + message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.stages && message.stages.length)) + message.stages = []; + message.stages.push($root.google.cloud.functions.v2alpha.Stage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + if (!$util.isString(message.statusDetail)) + return "statusDetail: string expected"; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + if (typeof message.cancelRequested !== "boolean") + return "cancelRequested: boolean expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; + if (message.requestResource != null && message.hasOwnProperty("requestResource")) { + var error = $root.google.protobuf.Any.verify(message.requestResource); + if (error) + return "requestResource." + error; + } + if (message.stages != null && message.hasOwnProperty("stages")) { + if (!Array.isArray(message.stages)) + return "stages: array expected"; + for (var i = 0; i < message.stages.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.Stage.verify(message.stages[i]); + if (error) + return "stages." + error; + } + } + return null; + }; + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.OperationMetadata) + return object; + var message = new $root.google.cloud.functions.v2alpha.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.functions.v2alpha.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.functions.v2alpha.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.statusDetail != null) + message.statusDetail = String(object.statusDetail); + if (object.cancelRequested != null) + message.cancelRequested = Boolean(object.cancelRequested); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); + if (object.requestResource != null) { + if (typeof object.requestResource !== "object") + throw TypeError(".google.cloud.functions.v2alpha.OperationMetadata.requestResource: object expected"); + message.requestResource = $root.google.protobuf.Any.fromObject(object.requestResource); + } + if (object.stages) { + if (!Array.isArray(object.stages)) + throw TypeError(".google.cloud.functions.v2alpha.OperationMetadata.stages: array expected"); + message.stages = []; + for (var i = 0; i < object.stages.length; ++i) { + if (typeof object.stages[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.OperationMetadata.stages: object expected"); + message.stages[i] = $root.google.cloud.functions.v2alpha.Stage.fromObject(object.stages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {google.cloud.functions.v2alpha.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stages = []; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.statusDetail = ""; + object.cancelRequested = false; + object.apiVersion = ""; + object.requestResource = null; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + object.statusDetail = message.statusDetail; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + object.cancelRequested = message.cancelRequested; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; + if (message.requestResource != null && message.hasOwnProperty("requestResource")) + object.requestResource = $root.google.protobuf.Any.toObject(message.requestResource, options); + if (message.stages && message.stages.length) { + object.stages = []; + for (var j = 0; j < message.stages.length; ++j) + object.stages[j] = $root.google.cloud.functions.v2alpha.Stage.toObject(message.stages[j], options); + } + return object; + }; + + /** + * Converts this OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationMetadata; + })(); + + v2alpha.Stage = (function() { + + /** + * Properties of a Stage. + * @memberof google.cloud.functions.v2alpha + * @interface IStage + * @property {google.cloud.functions.v2alpha.Stage.Name|null} [name] Stage name + * @property {string|null} [message] Stage message + * @property {google.cloud.functions.v2alpha.Stage.State|null} [state] Stage state + * @property {string|null} [resource] Stage resource + * @property {string|null} [resourceUri] Stage resourceUri + * @property {Array.|null} [stateMessages] Stage stateMessages + */ + + /** + * Constructs a new Stage. + * @memberof google.cloud.functions.v2alpha + * @classdesc Represents a Stage. + * @implements IStage + * @constructor + * @param {google.cloud.functions.v2alpha.IStage=} [properties] Properties to set + */ + function Stage(properties) { + this.stateMessages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Stage name. + * @member {google.cloud.functions.v2alpha.Stage.Name} name + * @memberof google.cloud.functions.v2alpha.Stage + * @instance + */ + Stage.prototype.name = 0; + + /** + * Stage message. + * @member {string} message + * @memberof google.cloud.functions.v2alpha.Stage + * @instance + */ + Stage.prototype.message = ""; + + /** + * Stage state. + * @member {google.cloud.functions.v2alpha.Stage.State} state + * @memberof google.cloud.functions.v2alpha.Stage + * @instance + */ + Stage.prototype.state = 0; + + /** + * Stage resource. + * @member {string} resource + * @memberof google.cloud.functions.v2alpha.Stage + * @instance + */ + Stage.prototype.resource = ""; + + /** + * Stage resourceUri. + * @member {string} resourceUri + * @memberof google.cloud.functions.v2alpha.Stage + * @instance + */ + Stage.prototype.resourceUri = ""; + + /** + * Stage stateMessages. + * @member {Array.} stateMessages + * @memberof google.cloud.functions.v2alpha.Stage + * @instance + */ + Stage.prototype.stateMessages = $util.emptyArray; + + /** + * Creates a new Stage instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {google.cloud.functions.v2alpha.IStage=} [properties] Properties to set + * @returns {google.cloud.functions.v2alpha.Stage} Stage instance + */ + Stage.create = function create(properties) { + return new Stage(properties); + }; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.cloud.functions.v2alpha.Stage.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {google.cloud.functions.v2alpha.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.name); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.resource); + if (message.resourceUri != null && Object.hasOwnProperty.call(message, "resourceUri")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.resourceUri); + if (message.stateMessages != null && message.stateMessages.length) + for (var i = 0; i < message.stateMessages.length; ++i) + $root.google.cloud.functions.v2alpha.StateMessage.encode(message.stateMessages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.cloud.functions.v2alpha.Stage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {google.cloud.functions.v2alpha.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2alpha.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2alpha.Stage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.int32(); + break; + case 2: + message.message = reader.string(); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.resource = reader.string(); + break; + case 5: + message.resourceUri = reader.string(); + break; + case 6: + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2alpha.StateMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2alpha.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Stage message. + * @function verify + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Stage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + switch (message.name) { + default: + return "name: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) + if (!$util.isString(message.resourceUri)) + return "resourceUri: string expected"; + if (message.stateMessages != null && message.hasOwnProperty("stateMessages")) { + if (!Array.isArray(message.stateMessages)) + return "stateMessages: array expected"; + for (var i = 0; i < message.stateMessages.length; ++i) { + var error = $root.google.cloud.functions.v2alpha.StateMessage.verify(message.stateMessages[i]); + if (error) + return "stateMessages." + error; + } + } + return null; + }; + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2alpha.Stage} Stage + */ + Stage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2alpha.Stage) + return object; + var message = new $root.google.cloud.functions.v2alpha.Stage(); + switch (object.name) { + case "NAME_UNSPECIFIED": + case 0: + message.name = 0; + break; + case "ARTIFACT_REGISTRY": + case 1: + message.name = 1; + break; + case "BUILD": + case 2: + message.name = 2; + break; + case "SERVICE": + case 3: + message.name = 3; + break; + case "TRIGGER": + case 4: + message.name = 4; + break; + case "SERVICE_ROLLBACK": + case 5: + message.name = 5; + break; + case "TRIGGER_ROLLBACK": + case 6: + message.name = 6; + break; + } + if (object.message != null) + message.message = String(object.message); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "NOT_STARTED": + case 1: + message.state = 1; + break; + case "IN_PROGRESS": + case 2: + message.state = 2; + break; + case "COMPLETE": + case 3: + message.state = 3; + break; + } + if (object.resource != null) + message.resource = String(object.resource); + if (object.resourceUri != null) + message.resourceUri = String(object.resourceUri); + if (object.stateMessages) { + if (!Array.isArray(object.stateMessages)) + throw TypeError(".google.cloud.functions.v2alpha.Stage.stateMessages: array expected"); + message.stateMessages = []; + for (var i = 0; i < object.stateMessages.length; ++i) { + if (typeof object.stateMessages[i] !== "object") + throw TypeError(".google.cloud.functions.v2alpha.Stage.stateMessages: object expected"); + message.stateMessages[i] = $root.google.cloud.functions.v2alpha.StateMessage.fromObject(object.stateMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {google.cloud.functions.v2alpha.Stage} message Stage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Stage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stateMessages = []; + if (options.defaults) { + object.name = options.enums === String ? "NAME_UNSPECIFIED" : 0; + object.message = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.resource = ""; + object.resourceUri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = options.enums === String ? $root.google.cloud.functions.v2alpha.Stage.Name[message.name] : message.name; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.functions.v2alpha.Stage.State[message.state] : message.state; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) + object.resourceUri = message.resourceUri; + if (message.stateMessages && message.stateMessages.length) { + object.stateMessages = []; + for (var j = 0; j < message.stateMessages.length; ++j) + object.stateMessages[j] = $root.google.cloud.functions.v2alpha.StateMessage.toObject(message.stateMessages[j], options); + } + return object; + }; + + /** + * Converts this Stage to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2alpha.Stage + * @instance + * @returns {Object.} JSON object + */ + Stage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Name enum. + * @name google.cloud.functions.v2alpha.Stage.Name + * @enum {number} + * @property {number} NAME_UNSPECIFIED=0 NAME_UNSPECIFIED value + * @property {number} ARTIFACT_REGISTRY=1 ARTIFACT_REGISTRY value + * @property {number} BUILD=2 BUILD value + * @property {number} SERVICE=3 SERVICE value + * @property {number} TRIGGER=4 TRIGGER value + * @property {number} SERVICE_ROLLBACK=5 SERVICE_ROLLBACK value + * @property {number} TRIGGER_ROLLBACK=6 TRIGGER_ROLLBACK value + */ + Stage.Name = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NAME_UNSPECIFIED"] = 0; + values[valuesById[1] = "ARTIFACT_REGISTRY"] = 1; + values[valuesById[2] = "BUILD"] = 2; + values[valuesById[3] = "SERVICE"] = 3; + values[valuesById[4] = "TRIGGER"] = 4; + values[valuesById[5] = "SERVICE_ROLLBACK"] = 5; + values[valuesById[6] = "TRIGGER_ROLLBACK"] = 6; + return values; + })(); + + /** + * State enum. + * @name google.cloud.functions.v2alpha.Stage.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} NOT_STARTED=1 NOT_STARTED value + * @property {number} IN_PROGRESS=2 IN_PROGRESS value + * @property {number} COMPLETE=3 COMPLETE value + */ + Stage.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOT_STARTED"] = 1; + values[valuesById[2] = "IN_PROGRESS"] = 2; + values[valuesById[3] = "COMPLETE"] = 3; + return values; + })(); + + return Stage; + })(); + + return v2alpha; + })(); + + functions.v2beta = (function() { + + /** + * Namespace v2beta. + * @memberof google.cloud.functions + * @namespace + */ + var v2beta = {}; + + v2beta.FunctionService = (function() { + + /** + * Constructs a new FunctionService service. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a FunctionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function FunctionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (FunctionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = FunctionService; + + /** + * Creates new FunctionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.functions.v2beta.FunctionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {FunctionService} RPC service. Useful where requests and/or responses are streamed. + */ + FunctionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#getFunction}. + * @memberof google.cloud.functions.v2beta.FunctionService + * @typedef GetFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2beta.Function} [response] Function + */ + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @param {google.cloud.functions.v2beta.FunctionService.GetFunctionCallback} callback Node-style callback called with the error, if any, and Function + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.getFunction = function getFunction(request, callback) { + return this.rpcCall(getFunction, $root.google.cloud.functions.v2beta.GetFunctionRequest, $root.google.cloud.functions.v2beta.Function, request, callback); + }, "name", { value: "GetFunction" }); + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#listFunctions}. + * @memberof google.cloud.functions.v2beta.FunctionService + * @typedef ListFunctionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2beta.ListFunctionsResponse} [response] ListFunctionsResponse + */ + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @param {google.cloud.functions.v2beta.FunctionService.ListFunctionsCallback} callback Node-style callback called with the error, if any, and ListFunctionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.listFunctions = function listFunctions(request, callback) { + return this.rpcCall(listFunctions, $root.google.cloud.functions.v2beta.ListFunctionsRequest, $root.google.cloud.functions.v2beta.ListFunctionsResponse, request, callback); + }, "name", { value: "ListFunctions" }); + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#createFunction}. + * @memberof google.cloud.functions.v2beta.FunctionService + * @typedef CreateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @param {google.cloud.functions.v2beta.FunctionService.CreateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.createFunction = function createFunction(request, callback) { + return this.rpcCall(createFunction, $root.google.cloud.functions.v2beta.CreateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateFunction" }); + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#updateFunction}. + * @memberof google.cloud.functions.v2beta.FunctionService + * @typedef UpdateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @param {google.cloud.functions.v2beta.FunctionService.UpdateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.updateFunction = function updateFunction(request, callback) { + return this.rpcCall(updateFunction, $root.google.cloud.functions.v2beta.UpdateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateFunction" }); + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#deleteFunction}. + * @memberof google.cloud.functions.v2beta.FunctionService + * @typedef DeleteFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @param {google.cloud.functions.v2beta.FunctionService.DeleteFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.deleteFunction = function deleteFunction(request, callback) { + return this.rpcCall(deleteFunction, $root.google.cloud.functions.v2beta.DeleteFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteFunction" }); + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#generateUploadUrl}. + * @memberof google.cloud.functions.v2beta.FunctionService + * @typedef GenerateUploadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2beta.GenerateUploadUrlResponse} [response] GenerateUploadUrlResponse + */ + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @param {google.cloud.functions.v2beta.FunctionService.GenerateUploadUrlCallback} callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.generateUploadUrl = function generateUploadUrl(request, callback) { + return this.rpcCall(generateUploadUrl, $root.google.cloud.functions.v2beta.GenerateUploadUrlRequest, $root.google.cloud.functions.v2beta.GenerateUploadUrlResponse, request, callback); + }, "name", { value: "GenerateUploadUrl" }); + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#generateDownloadUrl}. + * @memberof google.cloud.functions.v2beta.FunctionService + * @typedef GenerateDownloadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2beta.GenerateDownloadUrlResponse} [response] GenerateDownloadUrlResponse + */ + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @param {google.cloud.functions.v2beta.FunctionService.GenerateDownloadUrlCallback} callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.generateDownloadUrl = function generateDownloadUrl(request, callback) { + return this.rpcCall(generateDownloadUrl, $root.google.cloud.functions.v2beta.GenerateDownloadUrlRequest, $root.google.cloud.functions.v2beta.GenerateDownloadUrlResponse, request, callback); + }, "name", { value: "GenerateDownloadUrl" }); + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#listRuntimes}. + * @memberof google.cloud.functions.v2beta.FunctionService + * @typedef ListRuntimesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2beta.ListRuntimesResponse} [response] ListRuntimesResponse + */ + + /** + * Calls ListRuntimes. + * @function listRuntimes + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IListRuntimesRequest} request ListRuntimesRequest message or plain object + * @param {google.cloud.functions.v2beta.FunctionService.ListRuntimesCallback} callback Node-style callback called with the error, if any, and ListRuntimesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.listRuntimes = function listRuntimes(request, callback) { + return this.rpcCall(listRuntimes, $root.google.cloud.functions.v2beta.ListRuntimesRequest, $root.google.cloud.functions.v2beta.ListRuntimesResponse, request, callback); + }, "name", { value: "ListRuntimes" }); + + /** + * Calls ListRuntimes. + * @function listRuntimes + * @memberof google.cloud.functions.v2beta.FunctionService + * @instance + * @param {google.cloud.functions.v2beta.IListRuntimesRequest} request ListRuntimesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return FunctionService; + })(); + + /** + * Environment enum. + * @name google.cloud.functions.v2beta.Environment + * @enum {number} + * @property {number} ENVIRONMENT_UNSPECIFIED=0 ENVIRONMENT_UNSPECIFIED value + * @property {number} GEN_1=1 GEN_1 value + * @property {number} GEN_2=2 GEN_2 value + */ + v2beta.Environment = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENVIRONMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "GEN_1"] = 1; + values[valuesById[2] = "GEN_2"] = 2; + return values; + })(); + + v2beta.Function = (function() { + + /** + * Properties of a Function. + * @memberof google.cloud.functions.v2beta + * @interface IFunction + * @property {string|null} [name] Function name + * @property {google.cloud.functions.v2beta.Environment|null} [environment] Function environment + * @property {string|null} [description] Function description + * @property {google.cloud.functions.v2beta.IBuildConfig|null} [buildConfig] Function buildConfig + * @property {google.cloud.functions.v2beta.IServiceConfig|null} [serviceConfig] Function serviceConfig + * @property {google.cloud.functions.v2beta.IEventTrigger|null} [eventTrigger] Function eventTrigger + * @property {google.cloud.functions.v2beta.Function.State|null} [state] Function state + * @property {google.protobuf.ITimestamp|null} [updateTime] Function updateTime + * @property {Object.|null} [labels] Function labels + * @property {Array.|null} [stateMessages] Function stateMessages + */ + + /** + * Constructs a new Function. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a Function. + * @implements IFunction + * @constructor + * @param {google.cloud.functions.v2beta.IFunction=} [properties] Properties to set + */ + function Function(properties) { + this.labels = {}; + this.stateMessages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Function name. + * @member {string} name + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.name = ""; + + /** + * Function environment. + * @member {google.cloud.functions.v2beta.Environment} environment + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.environment = 0; + + /** + * Function description. + * @member {string} description + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.description = ""; + + /** + * Function buildConfig. + * @member {google.cloud.functions.v2beta.IBuildConfig|null|undefined} buildConfig + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.buildConfig = null; + + /** + * Function serviceConfig. + * @member {google.cloud.functions.v2beta.IServiceConfig|null|undefined} serviceConfig + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.serviceConfig = null; + + /** + * Function eventTrigger. + * @member {google.cloud.functions.v2beta.IEventTrigger|null|undefined} eventTrigger + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.eventTrigger = null; + + /** + * Function state. + * @member {google.cloud.functions.v2beta.Function.State} state + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.state = 0; + + /** + * Function updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.updateTime = null; + + /** + * Function labels. + * @member {Object.} labels + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.labels = $util.emptyObject; + + /** + * Function stateMessages. + * @member {Array.} stateMessages + * @memberof google.cloud.functions.v2beta.Function + * @instance + */ + Function.prototype.stateMessages = $util.emptyArray; + + /** + * Creates a new Function instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {google.cloud.functions.v2beta.IFunction=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.Function} Function instance + */ + Function.create = function create(properties) { + return new Function(properties); + }; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.cloud.functions.v2beta.Function.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {google.cloud.functions.v2beta.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.buildConfig != null && Object.hasOwnProperty.call(message, "buildConfig")) + $root.google.cloud.functions.v2beta.BuildConfig.encode(message.buildConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.serviceConfig != null && Object.hasOwnProperty.call(message, "serviceConfig")) + $root.google.cloud.functions.v2beta.ServiceConfig.encode(message.serviceConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.eventTrigger != null && Object.hasOwnProperty.call(message, "eventTrigger")) + $root.google.cloud.functions.v2beta.EventTrigger.encode(message.eventTrigger, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.stateMessages != null && message.stateMessages.length) + for (var i = 0; i < message.stateMessages.length; ++i) + $root.google.cloud.functions.v2beta.StateMessage.encode(message.stateMessages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.environment); + return writer; + }; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.Function.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {google.cloud.functions.v2beta.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Function message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.Function(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 10: + message.environment = reader.int32(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.buildConfig = $root.google.cloud.functions.v2beta.BuildConfig.decode(reader, reader.uint32()); + break; + case 4: + message.serviceConfig = $root.google.cloud.functions.v2beta.ServiceConfig.decode(reader, reader.uint32()); + break; + case 5: + message.eventTrigger = $root.google.cloud.functions.v2beta.EventTrigger.decode(reader, reader.uint32()); + break; + case 6: + message.state = reader.int32(); + break; + case 7: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 9: + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2beta.StateMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Function message. + * @function verify + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Function.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.environment != null && message.hasOwnProperty("environment")) + switch (message.environment) { + default: + return "environment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.buildConfig != null && message.hasOwnProperty("buildConfig")) { + var error = $root.google.cloud.functions.v2beta.BuildConfig.verify(message.buildConfig); + if (error) + return "buildConfig." + error; + } + if (message.serviceConfig != null && message.hasOwnProperty("serviceConfig")) { + var error = $root.google.cloud.functions.v2beta.ServiceConfig.verify(message.serviceConfig); + if (error) + return "serviceConfig." + error; + } + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) { + var error = $root.google.cloud.functions.v2beta.EventTrigger.verify(message.eventTrigger); + if (error) + return "eventTrigger." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.stateMessages != null && message.hasOwnProperty("stateMessages")) { + if (!Array.isArray(message.stateMessages)) + return "stateMessages: array expected"; + for (var i = 0; i < message.stateMessages.length; ++i) { + var error = $root.google.cloud.functions.v2beta.StateMessage.verify(message.stateMessages[i]); + if (error) + return "stateMessages." + error; + } + } + return null; + }; + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.Function} Function + */ + Function.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.Function) + return object; + var message = new $root.google.cloud.functions.v2beta.Function(); + if (object.name != null) + message.name = String(object.name); + switch (object.environment) { + case "ENVIRONMENT_UNSPECIFIED": + case 0: + message.environment = 0; + break; + case "GEN_1": + case 1: + message.environment = 1; + break; + case "GEN_2": + case 2: + message.environment = 2; + break; + } + if (object.description != null) + message.description = String(object.description); + if (object.buildConfig != null) { + if (typeof object.buildConfig !== "object") + throw TypeError(".google.cloud.functions.v2beta.Function.buildConfig: object expected"); + message.buildConfig = $root.google.cloud.functions.v2beta.BuildConfig.fromObject(object.buildConfig); + } + if (object.serviceConfig != null) { + if (typeof object.serviceConfig !== "object") + throw TypeError(".google.cloud.functions.v2beta.Function.serviceConfig: object expected"); + message.serviceConfig = $root.google.cloud.functions.v2beta.ServiceConfig.fromObject(object.serviceConfig); + } + if (object.eventTrigger != null) { + if (typeof object.eventTrigger !== "object") + throw TypeError(".google.cloud.functions.v2beta.Function.eventTrigger: object expected"); + message.eventTrigger = $root.google.cloud.functions.v2beta.EventTrigger.fromObject(object.eventTrigger); + } + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACTIVE": + case 1: + message.state = 1; + break; + case "FAILED": + case 2: + message.state = 2; + break; + case "DEPLOYING": + case 3: + message.state = 3; + break; + case "DELETING": + case 4: + message.state = 4; + break; + case "UNKNOWN": + case 5: + message.state = 5; + break; + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.functions.v2beta.Function.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.functions.v2beta.Function.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.stateMessages) { + if (!Array.isArray(object.stateMessages)) + throw TypeError(".google.cloud.functions.v2beta.Function.stateMessages: array expected"); + message.stateMessages = []; + for (var i = 0; i < object.stateMessages.length; ++i) { + if (typeof object.stateMessages[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.Function.stateMessages: object expected"); + message.stateMessages[i] = $root.google.cloud.functions.v2beta.StateMessage.fromObject(object.stateMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {google.cloud.functions.v2beta.Function} message Function + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Function.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stateMessages = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.buildConfig = null; + object.serviceConfig = null; + object.eventTrigger = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.updateTime = null; + object.environment = options.enums === String ? "ENVIRONMENT_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.buildConfig != null && message.hasOwnProperty("buildConfig")) + object.buildConfig = $root.google.cloud.functions.v2beta.BuildConfig.toObject(message.buildConfig, options); + if (message.serviceConfig != null && message.hasOwnProperty("serviceConfig")) + object.serviceConfig = $root.google.cloud.functions.v2beta.ServiceConfig.toObject(message.serviceConfig, options); + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) + object.eventTrigger = $root.google.cloud.functions.v2beta.EventTrigger.toObject(message.eventTrigger, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.functions.v2beta.Function.State[message.state] : message.state; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.stateMessages && message.stateMessages.length) { + object.stateMessages = []; + for (var j = 0; j < message.stateMessages.length; ++j) + object.stateMessages[j] = $root.google.cloud.functions.v2beta.StateMessage.toObject(message.stateMessages[j], options); + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = options.enums === String ? $root.google.cloud.functions.v2beta.Environment[message.environment] : message.environment; + return object; + }; + + /** + * Converts this Function to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.Function + * @instance + * @returns {Object.} JSON object + */ + Function.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.functions.v2beta.Function.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} FAILED=2 FAILED value + * @property {number} DEPLOYING=3 DEPLOYING value + * @property {number} DELETING=4 DELETING value + * @property {number} UNKNOWN=5 UNKNOWN value + */ + Function.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "FAILED"] = 2; + values[valuesById[3] = "DEPLOYING"] = 3; + values[valuesById[4] = "DELETING"] = 4; + values[valuesById[5] = "UNKNOWN"] = 5; + return values; + })(); + + return Function; + })(); + + v2beta.StateMessage = (function() { + + /** + * Properties of a StateMessage. + * @memberof google.cloud.functions.v2beta + * @interface IStateMessage + * @property {google.cloud.functions.v2beta.StateMessage.Severity|null} [severity] StateMessage severity + * @property {string|null} [type] StateMessage type + * @property {string|null} [message] StateMessage message + */ + + /** + * Constructs a new StateMessage. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a StateMessage. + * @implements IStateMessage + * @constructor + * @param {google.cloud.functions.v2beta.IStateMessage=} [properties] Properties to set + */ + function StateMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StateMessage severity. + * @member {google.cloud.functions.v2beta.StateMessage.Severity} severity + * @memberof google.cloud.functions.v2beta.StateMessage + * @instance + */ + StateMessage.prototype.severity = 0; + + /** + * StateMessage type. + * @member {string} type + * @memberof google.cloud.functions.v2beta.StateMessage + * @instance + */ + StateMessage.prototype.type = ""; + + /** + * StateMessage message. + * @member {string} message + * @memberof google.cloud.functions.v2beta.StateMessage + * @instance + */ + StateMessage.prototype.message = ""; + + /** + * Creates a new StateMessage instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {google.cloud.functions.v2beta.IStateMessage=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.StateMessage} StateMessage instance + */ + StateMessage.create = function create(properties) { + return new StateMessage(properties); + }; + + /** + * Encodes the specified StateMessage message. Does not implicitly {@link google.cloud.functions.v2beta.StateMessage.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {google.cloud.functions.v2beta.IStateMessage} message StateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.severity); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified StateMessage message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.StateMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {google.cloud.functions.v2beta.IStateMessage} message StateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StateMessage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.StateMessage} StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.StateMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.severity = reader.int32(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StateMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.StateMessage} StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StateMessage message. + * @function verify + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StateMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.severity != null && message.hasOwnProperty("severity")) + switch (message.severity) { + default: + return "severity: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a StateMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.StateMessage} StateMessage + */ + StateMessage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.StateMessage) + return object; + var message = new $root.google.cloud.functions.v2beta.StateMessage(); + switch (object.severity) { + case "SEVERITY_UNSPECIFIED": + case 0: + message.severity = 0; + break; + case "ERROR": + case 1: + message.severity = 1; + break; + case "WARNING": + case 2: + message.severity = 2; + break; + case "INFO": + case 3: + message.severity = 3; + break; + } + if (object.type != null) + message.type = String(object.type); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a StateMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {google.cloud.functions.v2beta.StateMessage} message StateMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StateMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.severity = options.enums === String ? "SEVERITY_UNSPECIFIED" : 0; + object.type = ""; + object.message = ""; + } + if (message.severity != null && message.hasOwnProperty("severity")) + object.severity = options.enums === String ? $root.google.cloud.functions.v2beta.StateMessage.Severity[message.severity] : message.severity; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this StateMessage to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.StateMessage + * @instance + * @returns {Object.} JSON object + */ + StateMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Severity enum. + * @name google.cloud.functions.v2beta.StateMessage.Severity + * @enum {number} + * @property {number} SEVERITY_UNSPECIFIED=0 SEVERITY_UNSPECIFIED value + * @property {number} ERROR=1 ERROR value + * @property {number} WARNING=2 WARNING value + * @property {number} INFO=3 INFO value + */ + StateMessage.Severity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEVERITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ERROR"] = 1; + values[valuesById[2] = "WARNING"] = 2; + values[valuesById[3] = "INFO"] = 3; + return values; + })(); + + return StateMessage; + })(); + + v2beta.StorageSource = (function() { + + /** + * Properties of a StorageSource. + * @memberof google.cloud.functions.v2beta + * @interface IStorageSource + * @property {string|null} [bucket] StorageSource bucket + * @property {string|null} [object] StorageSource object + * @property {number|Long|null} [generation] StorageSource generation + */ + + /** + * Constructs a new StorageSource. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a StorageSource. + * @implements IStorageSource + * @constructor + * @param {google.cloud.functions.v2beta.IStorageSource=} [properties] Properties to set + */ + function StorageSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StorageSource bucket. + * @member {string} bucket + * @memberof google.cloud.functions.v2beta.StorageSource + * @instance + */ + StorageSource.prototype.bucket = ""; + + /** + * StorageSource object. + * @member {string} object + * @memberof google.cloud.functions.v2beta.StorageSource + * @instance + */ + StorageSource.prototype.object = ""; + + /** + * StorageSource generation. + * @member {number|Long} generation + * @memberof google.cloud.functions.v2beta.StorageSource + * @instance + */ + StorageSource.prototype.generation = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new StorageSource instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {google.cloud.functions.v2beta.IStorageSource=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.StorageSource} StorageSource instance + */ + StorageSource.create = function create(properties) { + return new StorageSource(properties); + }; + + /** + * Encodes the specified StorageSource message. Does not implicitly {@link google.cloud.functions.v2beta.StorageSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {google.cloud.functions.v2beta.IStorageSource} message StorageSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.bucket); + if (message.object != null && Object.hasOwnProperty.call(message, "object")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.object); + if (message.generation != null && Object.hasOwnProperty.call(message, "generation")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.generation); + return writer; + }; + + /** + * Encodes the specified StorageSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.StorageSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {google.cloud.functions.v2beta.IStorageSource} message StorageSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StorageSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.StorageSource} StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.StorageSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bucket = reader.string(); + break; + case 2: + message.object = reader.string(); + break; + case 3: + message.generation = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StorageSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.StorageSource} StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StorageSource message. + * @function verify + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StorageSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) + if (!$util.isString(message.bucket)) + return "bucket: string expected"; + if (message.object != null && message.hasOwnProperty("object")) + if (!$util.isString(message.object)) + return "object: string expected"; + if (message.generation != null && message.hasOwnProperty("generation")) + if (!$util.isInteger(message.generation) && !(message.generation && $util.isInteger(message.generation.low) && $util.isInteger(message.generation.high))) + return "generation: integer|Long expected"; + return null; + }; + + /** + * Creates a StorageSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.StorageSource} StorageSource + */ + StorageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.StorageSource) + return object; + var message = new $root.google.cloud.functions.v2beta.StorageSource(); + if (object.bucket != null) + message.bucket = String(object.bucket); + if (object.object != null) + message.object = String(object.object); + if (object.generation != null) + if ($util.Long) + (message.generation = $util.Long.fromValue(object.generation)).unsigned = false; + else if (typeof object.generation === "string") + message.generation = parseInt(object.generation, 10); + else if (typeof object.generation === "number") + message.generation = object.generation; + else if (typeof object.generation === "object") + message.generation = new $util.LongBits(object.generation.low >>> 0, object.generation.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a StorageSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {google.cloud.functions.v2beta.StorageSource} message StorageSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StorageSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.bucket = ""; + object.object = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.generation = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.generation = options.longs === String ? "0" : 0; + } + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = message.bucket; + if (message.object != null && message.hasOwnProperty("object")) + object.object = message.object; + if (message.generation != null && message.hasOwnProperty("generation")) + if (typeof message.generation === "number") + object.generation = options.longs === String ? String(message.generation) : message.generation; + else + object.generation = options.longs === String ? $util.Long.prototype.toString.call(message.generation) : options.longs === Number ? new $util.LongBits(message.generation.low >>> 0, message.generation.high >>> 0).toNumber() : message.generation; + return object; + }; + + /** + * Converts this StorageSource to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.StorageSource + * @instance + * @returns {Object.} JSON object + */ + StorageSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StorageSource; + })(); + + v2beta.RepoSource = (function() { + + /** + * Properties of a RepoSource. + * @memberof google.cloud.functions.v2beta + * @interface IRepoSource + * @property {string|null} [branchName] RepoSource branchName + * @property {string|null} [tagName] RepoSource tagName + * @property {string|null} [commitSha] RepoSource commitSha + * @property {string|null} [projectId] RepoSource projectId + * @property {string|null} [repoName] RepoSource repoName + * @property {string|null} [dir] RepoSource dir + * @property {boolean|null} [invertRegex] RepoSource invertRegex + */ + + /** + * Constructs a new RepoSource. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a RepoSource. + * @implements IRepoSource + * @constructor + * @param {google.cloud.functions.v2beta.IRepoSource=} [properties] Properties to set + */ + function RepoSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RepoSource branchName. + * @member {string|null|undefined} branchName + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + */ + RepoSource.prototype.branchName = null; + + /** + * RepoSource tagName. + * @member {string|null|undefined} tagName + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + */ + RepoSource.prototype.tagName = null; + + /** + * RepoSource commitSha. + * @member {string|null|undefined} commitSha + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + */ + RepoSource.prototype.commitSha = null; + + /** + * RepoSource projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + */ + RepoSource.prototype.projectId = ""; + + /** + * RepoSource repoName. + * @member {string} repoName + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + */ + RepoSource.prototype.repoName = ""; + + /** + * RepoSource dir. + * @member {string} dir + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + */ + RepoSource.prototype.dir = ""; + + /** + * RepoSource invertRegex. + * @member {boolean} invertRegex + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + */ + RepoSource.prototype.invertRegex = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RepoSource revision. + * @member {"branchName"|"tagName"|"commitSha"|undefined} revision + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + */ + Object.defineProperty(RepoSource.prototype, "revision", { + get: $util.oneOfGetter($oneOfFields = ["branchName", "tagName", "commitSha"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RepoSource instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {google.cloud.functions.v2beta.IRepoSource=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.RepoSource} RepoSource instance + */ + RepoSource.create = function create(properties) { + return new RepoSource(properties); + }; + + /** + * Encodes the specified RepoSource message. Does not implicitly {@link google.cloud.functions.v2beta.RepoSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {google.cloud.functions.v2beta.IRepoSource} message RepoSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RepoSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); + if (message.repoName != null && Object.hasOwnProperty.call(message, "repoName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.repoName); + if (message.branchName != null && Object.hasOwnProperty.call(message, "branchName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.branchName); + if (message.tagName != null && Object.hasOwnProperty.call(message, "tagName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.tagName); + if (message.commitSha != null && Object.hasOwnProperty.call(message, "commitSha")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.commitSha); + if (message.dir != null && Object.hasOwnProperty.call(message, "dir")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dir); + if (message.invertRegex != null && Object.hasOwnProperty.call(message, "invertRegex")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.invertRegex); + return writer; + }; + + /** + * Encodes the specified RepoSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.RepoSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {google.cloud.functions.v2beta.IRepoSource} message RepoSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RepoSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RepoSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.RepoSource} RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RepoSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.RepoSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.branchName = reader.string(); + break; + case 4: + message.tagName = reader.string(); + break; + case 5: + message.commitSha = reader.string(); + break; + case 1: + message.projectId = reader.string(); + break; + case 2: + message.repoName = reader.string(); + break; + case 6: + message.dir = reader.string(); + break; + case 7: + message.invertRegex = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RepoSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.RepoSource} RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RepoSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RepoSource message. + * @function verify + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RepoSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.branchName != null && message.hasOwnProperty("branchName")) { + properties.revision = 1; + if (!$util.isString(message.branchName)) + return "branchName: string expected"; + } + if (message.tagName != null && message.hasOwnProperty("tagName")) { + if (properties.revision === 1) + return "revision: multiple values"; + properties.revision = 1; + if (!$util.isString(message.tagName)) + return "tagName: string expected"; + } + if (message.commitSha != null && message.hasOwnProperty("commitSha")) { + if (properties.revision === 1) + return "revision: multiple values"; + properties.revision = 1; + if (!$util.isString(message.commitSha)) + return "commitSha: string expected"; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.repoName != null && message.hasOwnProperty("repoName")) + if (!$util.isString(message.repoName)) + return "repoName: string expected"; + if (message.dir != null && message.hasOwnProperty("dir")) + if (!$util.isString(message.dir)) + return "dir: string expected"; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + if (typeof message.invertRegex !== "boolean") + return "invertRegex: boolean expected"; + return null; + }; + + /** + * Creates a RepoSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.RepoSource} RepoSource + */ + RepoSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.RepoSource) + return object; + var message = new $root.google.cloud.functions.v2beta.RepoSource(); + if (object.branchName != null) + message.branchName = String(object.branchName); + if (object.tagName != null) + message.tagName = String(object.tagName); + if (object.commitSha != null) + message.commitSha = String(object.commitSha); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.repoName != null) + message.repoName = String(object.repoName); + if (object.dir != null) + message.dir = String(object.dir); + if (object.invertRegex != null) + message.invertRegex = Boolean(object.invertRegex); + return message; + }; + + /** + * Creates a plain object from a RepoSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {google.cloud.functions.v2beta.RepoSource} message RepoSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RepoSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.projectId = ""; + object.repoName = ""; + object.dir = ""; + object.invertRegex = false; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.repoName != null && message.hasOwnProperty("repoName")) + object.repoName = message.repoName; + if (message.branchName != null && message.hasOwnProperty("branchName")) { + object.branchName = message.branchName; + if (options.oneofs) + object.revision = "branchName"; + } + if (message.tagName != null && message.hasOwnProperty("tagName")) { + object.tagName = message.tagName; + if (options.oneofs) + object.revision = "tagName"; + } + if (message.commitSha != null && message.hasOwnProperty("commitSha")) { + object.commitSha = message.commitSha; + if (options.oneofs) + object.revision = "commitSha"; + } + if (message.dir != null && message.hasOwnProperty("dir")) + object.dir = message.dir; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + object.invertRegex = message.invertRegex; + return object; + }; + + /** + * Converts this RepoSource to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.RepoSource + * @instance + * @returns {Object.} JSON object + */ + RepoSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RepoSource; + })(); + + v2beta.Source = (function() { + + /** + * Properties of a Source. + * @memberof google.cloud.functions.v2beta + * @interface ISource + * @property {google.cloud.functions.v2beta.IStorageSource|null} [storageSource] Source storageSource + * @property {google.cloud.functions.v2beta.IRepoSource|null} [repoSource] Source repoSource + */ + + /** + * Constructs a new Source. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a Source. + * @implements ISource + * @constructor + * @param {google.cloud.functions.v2beta.ISource=} [properties] Properties to set + */ + function Source(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Source storageSource. + * @member {google.cloud.functions.v2beta.IStorageSource|null|undefined} storageSource + * @memberof google.cloud.functions.v2beta.Source + * @instance + */ + Source.prototype.storageSource = null; + + /** + * Source repoSource. + * @member {google.cloud.functions.v2beta.IRepoSource|null|undefined} repoSource + * @memberof google.cloud.functions.v2beta.Source + * @instance + */ + Source.prototype.repoSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Source source. + * @member {"storageSource"|"repoSource"|undefined} source + * @memberof google.cloud.functions.v2beta.Source + * @instance + */ + Object.defineProperty(Source.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["storageSource", "repoSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Source instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {google.cloud.functions.v2beta.ISource=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.Source} Source instance + */ + Source.create = function create(properties) { + return new Source(properties); + }; + + /** + * Encodes the specified Source message. Does not implicitly {@link google.cloud.functions.v2beta.Source.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {google.cloud.functions.v2beta.ISource} message Source message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Source.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.storageSource != null && Object.hasOwnProperty.call(message, "storageSource")) + $root.google.cloud.functions.v2beta.StorageSource.encode(message.storageSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.repoSource != null && Object.hasOwnProperty.call(message, "repoSource")) + $root.google.cloud.functions.v2beta.RepoSource.encode(message.repoSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Source message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.Source.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {google.cloud.functions.v2beta.ISource} message Source message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Source.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Source message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.Source} Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Source.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.Source(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.storageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); + break; + case 2: + message.repoSource = $root.google.cloud.functions.v2beta.RepoSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Source message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.Source} Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Source.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Source message. + * @function verify + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Source.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + properties.source = 1; + { + var error = $root.google.cloud.functions.v2beta.StorageSource.verify(message.storageSource); + if (error) + return "storageSource." + error; + } + } + if (message.repoSource != null && message.hasOwnProperty("repoSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.functions.v2beta.RepoSource.verify(message.repoSource); + if (error) + return "repoSource." + error; + } + } + return null; + }; + + /** + * Creates a Source message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.Source} Source + */ + Source.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.Source) + return object; + var message = new $root.google.cloud.functions.v2beta.Source(); + if (object.storageSource != null) { + if (typeof object.storageSource !== "object") + throw TypeError(".google.cloud.functions.v2beta.Source.storageSource: object expected"); + message.storageSource = $root.google.cloud.functions.v2beta.StorageSource.fromObject(object.storageSource); + } + if (object.repoSource != null) { + if (typeof object.repoSource !== "object") + throw TypeError(".google.cloud.functions.v2beta.Source.repoSource: object expected"); + message.repoSource = $root.google.cloud.functions.v2beta.RepoSource.fromObject(object.repoSource); + } + return message; + }; + + /** + * Creates a plain object from a Source message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {google.cloud.functions.v2beta.Source} message Source + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Source.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + object.storageSource = $root.google.cloud.functions.v2beta.StorageSource.toObject(message.storageSource, options); + if (options.oneofs) + object.source = "storageSource"; + } + if (message.repoSource != null && message.hasOwnProperty("repoSource")) { + object.repoSource = $root.google.cloud.functions.v2beta.RepoSource.toObject(message.repoSource, options); + if (options.oneofs) + object.source = "repoSource"; + } + return object; + }; + + /** + * Converts this Source to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.Source + * @instance + * @returns {Object.} JSON object + */ + Source.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Source; + })(); + + v2beta.SourceProvenance = (function() { + + /** + * Properties of a SourceProvenance. + * @memberof google.cloud.functions.v2beta + * @interface ISourceProvenance + * @property {google.cloud.functions.v2beta.IStorageSource|null} [resolvedStorageSource] SourceProvenance resolvedStorageSource + * @property {google.cloud.functions.v2beta.IRepoSource|null} [resolvedRepoSource] SourceProvenance resolvedRepoSource + */ + + /** + * Constructs a new SourceProvenance. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a SourceProvenance. + * @implements ISourceProvenance + * @constructor + * @param {google.cloud.functions.v2beta.ISourceProvenance=} [properties] Properties to set + */ + function SourceProvenance(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceProvenance resolvedStorageSource. + * @member {google.cloud.functions.v2beta.IStorageSource|null|undefined} resolvedStorageSource + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedStorageSource = null; + + /** + * SourceProvenance resolvedRepoSource. + * @member {google.cloud.functions.v2beta.IRepoSource|null|undefined} resolvedRepoSource + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedRepoSource = null; + + /** + * Creates a new SourceProvenance instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {google.cloud.functions.v2beta.ISourceProvenance=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.SourceProvenance} SourceProvenance instance + */ + SourceProvenance.create = function create(properties) { + return new SourceProvenance(properties); + }; + + /** + * Encodes the specified SourceProvenance message. Does not implicitly {@link google.cloud.functions.v2beta.SourceProvenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {google.cloud.functions.v2beta.ISourceProvenance} message SourceProvenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceProvenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resolvedStorageSource != null && Object.hasOwnProperty.call(message, "resolvedStorageSource")) + $root.google.cloud.functions.v2beta.StorageSource.encode(message.resolvedStorageSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.resolvedRepoSource != null && Object.hasOwnProperty.call(message, "resolvedRepoSource")) + $root.google.cloud.functions.v2beta.RepoSource.encode(message.resolvedRepoSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceProvenance message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.SourceProvenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {google.cloud.functions.v2beta.ISourceProvenance} message SourceProvenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceProvenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.SourceProvenance} SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceProvenance.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.SourceProvenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resolvedStorageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); + break; + case 2: + message.resolvedRepoSource = $root.google.cloud.functions.v2beta.RepoSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.SourceProvenance} SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceProvenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceProvenance message. + * @function verify + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceProvenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) { + var error = $root.google.cloud.functions.v2beta.StorageSource.verify(message.resolvedStorageSource); + if (error) + return "resolvedStorageSource." + error; + } + if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) { + var error = $root.google.cloud.functions.v2beta.RepoSource.verify(message.resolvedRepoSource); + if (error) + return "resolvedRepoSource." + error; + } + return null; + }; + + /** + * Creates a SourceProvenance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.SourceProvenance} SourceProvenance + */ + SourceProvenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.SourceProvenance) + return object; + var message = new $root.google.cloud.functions.v2beta.SourceProvenance(); + if (object.resolvedStorageSource != null) { + if (typeof object.resolvedStorageSource !== "object") + throw TypeError(".google.cloud.functions.v2beta.SourceProvenance.resolvedStorageSource: object expected"); + message.resolvedStorageSource = $root.google.cloud.functions.v2beta.StorageSource.fromObject(object.resolvedStorageSource); + } + if (object.resolvedRepoSource != null) { + if (typeof object.resolvedRepoSource !== "object") + throw TypeError(".google.cloud.functions.v2beta.SourceProvenance.resolvedRepoSource: object expected"); + message.resolvedRepoSource = $root.google.cloud.functions.v2beta.RepoSource.fromObject(object.resolvedRepoSource); + } + return message; + }; + + /** + * Creates a plain object from a SourceProvenance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {google.cloud.functions.v2beta.SourceProvenance} message SourceProvenance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceProvenance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resolvedStorageSource = null; + object.resolvedRepoSource = null; + } + if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) + object.resolvedStorageSource = $root.google.cloud.functions.v2beta.StorageSource.toObject(message.resolvedStorageSource, options); + if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) + object.resolvedRepoSource = $root.google.cloud.functions.v2beta.RepoSource.toObject(message.resolvedRepoSource, options); + return object; + }; + + /** + * Converts this SourceProvenance to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @instance + * @returns {Object.} JSON object + */ + SourceProvenance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SourceProvenance; + })(); + + v2beta.BuildConfig = (function() { + + /** + * Properties of a BuildConfig. + * @memberof google.cloud.functions.v2beta + * @interface IBuildConfig + * @property {string|null} [build] BuildConfig build + * @property {string|null} [runtime] BuildConfig runtime + * @property {string|null} [entryPoint] BuildConfig entryPoint + * @property {google.cloud.functions.v2beta.ISource|null} [source] BuildConfig source + * @property {google.cloud.functions.v2beta.ISourceProvenance|null} [sourceProvenance] BuildConfig sourceProvenance + * @property {string|null} [workerPool] BuildConfig workerPool + * @property {Object.|null} [environmentVariables] BuildConfig environmentVariables + * @property {string|null} [dockerRepository] BuildConfig dockerRepository + */ + + /** + * Constructs a new BuildConfig. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a BuildConfig. + * @implements IBuildConfig + * @constructor + * @param {google.cloud.functions.v2beta.IBuildConfig=} [properties] Properties to set + */ + function BuildConfig(properties) { + this.environmentVariables = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BuildConfig build. + * @member {string} build + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + */ + BuildConfig.prototype.build = ""; + + /** + * BuildConfig runtime. + * @member {string} runtime + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + */ + BuildConfig.prototype.runtime = ""; + + /** + * BuildConfig entryPoint. + * @member {string} entryPoint + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + */ + BuildConfig.prototype.entryPoint = ""; + + /** + * BuildConfig source. + * @member {google.cloud.functions.v2beta.ISource|null|undefined} source + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + */ + BuildConfig.prototype.source = null; + + /** + * BuildConfig sourceProvenance. + * @member {google.cloud.functions.v2beta.ISourceProvenance|null|undefined} sourceProvenance + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + */ + BuildConfig.prototype.sourceProvenance = null; + + /** + * BuildConfig workerPool. + * @member {string} workerPool + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + */ + BuildConfig.prototype.workerPool = ""; + + /** + * BuildConfig environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + */ + BuildConfig.prototype.environmentVariables = $util.emptyObject; + + /** + * BuildConfig dockerRepository. + * @member {string} dockerRepository + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + */ + BuildConfig.prototype.dockerRepository = ""; + + /** + * Creates a new BuildConfig instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {google.cloud.functions.v2beta.IBuildConfig=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.BuildConfig} BuildConfig instance + */ + BuildConfig.create = function create(properties) { + return new BuildConfig(properties); + }; + + /** + * Encodes the specified BuildConfig message. Does not implicitly {@link google.cloud.functions.v2beta.BuildConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {google.cloud.functions.v2beta.IBuildConfig} message BuildConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.build != null && Object.hasOwnProperty.call(message, "build")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.build); + if (message.runtime != null && Object.hasOwnProperty.call(message, "runtime")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.runtime); + if (message.entryPoint != null && Object.hasOwnProperty.call(message, "entryPoint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.entryPoint); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + $root.google.cloud.functions.v2beta.Source.encode(message.source, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.workerPool != null && Object.hasOwnProperty.call(message, "workerPool")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.workerPool); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environmentVariables[keys[i]]).ldelim(); + if (message.dockerRepository != null && Object.hasOwnProperty.call(message, "dockerRepository")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.dockerRepository); + if (message.sourceProvenance != null && Object.hasOwnProperty.call(message, "sourceProvenance")) + $root.google.cloud.functions.v2beta.SourceProvenance.encode(message.sourceProvenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BuildConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.BuildConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {google.cloud.functions.v2beta.IBuildConfig} message BuildConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BuildConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.BuildConfig} BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.BuildConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.build = reader.string(); + break; + case 2: + message.runtime = reader.string(); + break; + case 3: + message.entryPoint = reader.string(); + break; + case 4: + message.source = $root.google.cloud.functions.v2beta.Source.decode(reader, reader.uint32()); + break; + case 8: + message.sourceProvenance = $root.google.cloud.functions.v2beta.SourceProvenance.decode(reader, reader.uint32()); + break; + case 5: + message.workerPool = reader.string(); + break; + case 6: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.environmentVariables[key] = value; + break; + case 7: + message.dockerRepository = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BuildConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.BuildConfig} BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BuildConfig message. + * @function verify + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BuildConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.build != null && message.hasOwnProperty("build")) + if (!$util.isString(message.build)) + return "build: string expected"; + if (message.runtime != null && message.hasOwnProperty("runtime")) + if (!$util.isString(message.runtime)) + return "runtime: string expected"; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + if (!$util.isString(message.entryPoint)) + return "entryPoint: string expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.functions.v2beta.Source.verify(message.source); + if (error) + return "source." + error; + } + if (message.sourceProvenance != null && message.hasOwnProperty("sourceProvenance")) { + var error = $root.google.cloud.functions.v2beta.SourceProvenance.verify(message.sourceProvenance); + if (error) + return "sourceProvenance." + error; + } + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + if (!$util.isString(message.workerPool)) + return "workerPool: string expected"; + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + if (!$util.isString(message.dockerRepository)) + return "dockerRepository: string expected"; + return null; + }; + + /** + * Creates a BuildConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.BuildConfig} BuildConfig + */ + BuildConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.BuildConfig) + return object; + var message = new $root.google.cloud.functions.v2beta.BuildConfig(); + if (object.build != null) + message.build = String(object.build); + if (object.runtime != null) + message.runtime = String(object.runtime); + if (object.entryPoint != null) + message.entryPoint = String(object.entryPoint); + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.functions.v2beta.BuildConfig.source: object expected"); + message.source = $root.google.cloud.functions.v2beta.Source.fromObject(object.source); + } + if (object.sourceProvenance != null) { + if (typeof object.sourceProvenance !== "object") + throw TypeError(".google.cloud.functions.v2beta.BuildConfig.sourceProvenance: object expected"); + message.sourceProvenance = $root.google.cloud.functions.v2beta.SourceProvenance.fromObject(object.sourceProvenance); + } + if (object.workerPool != null) + message.workerPool = String(object.workerPool); + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v2beta.BuildConfig.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.dockerRepository != null) + message.dockerRepository = String(object.dockerRepository); + return message; + }; + + /** + * Creates a plain object from a BuildConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {google.cloud.functions.v2beta.BuildConfig} message BuildConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BuildConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.environmentVariables = {}; + if (options.defaults) { + object.build = ""; + object.runtime = ""; + object.entryPoint = ""; + object.source = null; + object.workerPool = ""; + object.dockerRepository = ""; + object.sourceProvenance = null; + } + if (message.build != null && message.hasOwnProperty("build")) + object.build = message.build; + if (message.runtime != null && message.hasOwnProperty("runtime")) + object.runtime = message.runtime; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + object.entryPoint = message.entryPoint; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.functions.v2beta.Source.toObject(message.source, options); + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + object.workerPool = message.workerPool; + var keys2; + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + object.dockerRepository = message.dockerRepository; + if (message.sourceProvenance != null && message.hasOwnProperty("sourceProvenance")) + object.sourceProvenance = $root.google.cloud.functions.v2beta.SourceProvenance.toObject(message.sourceProvenance, options); + return object; + }; + + /** + * Converts this BuildConfig to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.BuildConfig + * @instance + * @returns {Object.} JSON object + */ + BuildConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BuildConfig; + })(); + + v2beta.ServiceConfig = (function() { + + /** + * Properties of a ServiceConfig. + * @memberof google.cloud.functions.v2beta + * @interface IServiceConfig + * @property {string|null} [service] ServiceConfig service + * @property {number|null} [timeoutSeconds] ServiceConfig timeoutSeconds + * @property {string|null} [availableMemory] ServiceConfig availableMemory + * @property {Object.|null} [environmentVariables] ServiceConfig environmentVariables + * @property {number|null} [maxInstanceCount] ServiceConfig maxInstanceCount + * @property {number|null} [minInstanceCount] ServiceConfig minInstanceCount + * @property {string|null} [vpcConnector] ServiceConfig vpcConnector + * @property {google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings|null} [vpcConnectorEgressSettings] ServiceConfig vpcConnectorEgressSettings + * @property {google.cloud.functions.v2beta.ServiceConfig.IngressSettings|null} [ingressSettings] ServiceConfig ingressSettings + * @property {string|null} [uri] ServiceConfig uri + * @property {string|null} [serviceAccountEmail] ServiceConfig serviceAccountEmail + * @property {boolean|null} [allTrafficOnLatestRevision] ServiceConfig allTrafficOnLatestRevision + * @property {Array.|null} [secretEnvironmentVariables] ServiceConfig secretEnvironmentVariables + * @property {Array.|null} [secretVolumes] ServiceConfig secretVolumes + * @property {string|null} [revision] ServiceConfig revision + */ + + /** + * Constructs a new ServiceConfig. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a ServiceConfig. + * @implements IServiceConfig + * @constructor + * @param {google.cloud.functions.v2beta.IServiceConfig=} [properties] Properties to set + */ + function ServiceConfig(properties) { + this.environmentVariables = {}; + this.secretEnvironmentVariables = []; + this.secretVolumes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceConfig service. + * @member {string} service + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.service = ""; + + /** + * ServiceConfig timeoutSeconds. + * @member {number} timeoutSeconds + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.timeoutSeconds = 0; + + /** + * ServiceConfig availableMemory. + * @member {string} availableMemory + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.availableMemory = ""; + + /** + * ServiceConfig environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.environmentVariables = $util.emptyObject; + + /** + * ServiceConfig maxInstanceCount. + * @member {number} maxInstanceCount + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.maxInstanceCount = 0; + + /** + * ServiceConfig minInstanceCount. + * @member {number} minInstanceCount + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.minInstanceCount = 0; + + /** + * ServiceConfig vpcConnector. + * @member {string} vpcConnector + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.vpcConnector = ""; + + /** + * ServiceConfig vpcConnectorEgressSettings. + * @member {google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings} vpcConnectorEgressSettings + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.vpcConnectorEgressSettings = 0; + + /** + * ServiceConfig ingressSettings. + * @member {google.cloud.functions.v2beta.ServiceConfig.IngressSettings} ingressSettings + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.ingressSettings = 0; + + /** + * ServiceConfig uri. + * @member {string} uri + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.uri = ""; + + /** + * ServiceConfig serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.serviceAccountEmail = ""; + + /** + * ServiceConfig allTrafficOnLatestRevision. + * @member {boolean} allTrafficOnLatestRevision + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.allTrafficOnLatestRevision = false; + + /** + * ServiceConfig secretEnvironmentVariables. + * @member {Array.} secretEnvironmentVariables + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.secretEnvironmentVariables = $util.emptyArray; + + /** + * ServiceConfig secretVolumes. + * @member {Array.} secretVolumes + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.secretVolumes = $util.emptyArray; + + /** + * ServiceConfig revision. + * @member {string} revision + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + */ + ServiceConfig.prototype.revision = ""; + + /** + * Creates a new ServiceConfig instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {google.cloud.functions.v2beta.IServiceConfig=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.ServiceConfig} ServiceConfig instance + */ + ServiceConfig.create = function create(properties) { + return new ServiceConfig(properties); + }; + + /** + * Encodes the specified ServiceConfig message. Does not implicitly {@link google.cloud.functions.v2beta.ServiceConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {google.cloud.functions.v2beta.IServiceConfig} message ServiceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.service); + if (message.timeoutSeconds != null && Object.hasOwnProperty.call(message, "timeoutSeconds")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.timeoutSeconds); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environmentVariables[keys[i]]).ldelim(); + if (message.maxInstanceCount != null && Object.hasOwnProperty.call(message, "maxInstanceCount")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxInstanceCount); + if (message.vpcConnector != null && Object.hasOwnProperty.call(message, "vpcConnector")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.vpcConnector); + if (message.vpcConnectorEgressSettings != null && Object.hasOwnProperty.call(message, "vpcConnectorEgressSettings")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.vpcConnectorEgressSettings); + if (message.ingressSettings != null && Object.hasOwnProperty.call(message, "ingressSettings")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.ingressSettings); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.uri); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.serviceAccountEmail); + if (message.minInstanceCount != null && Object.hasOwnProperty.call(message, "minInstanceCount")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.minInstanceCount); + if (message.availableMemory != null && Object.hasOwnProperty.call(message, "availableMemory")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.availableMemory); + if (message.allTrafficOnLatestRevision != null && Object.hasOwnProperty.call(message, "allTrafficOnLatestRevision")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.allTrafficOnLatestRevision); + if (message.secretEnvironmentVariables != null && message.secretEnvironmentVariables.length) + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) + $root.google.cloud.functions.v2beta.SecretEnvVar.encode(message.secretEnvironmentVariables[i], writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.revision); + if (message.secretVolumes != null && message.secretVolumes.length) + for (var i = 0; i < message.secretVolumes.length; ++i) + $root.google.cloud.functions.v2beta.SecretVolume.encode(message.secretVolumes[i], writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ServiceConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {google.cloud.functions.v2beta.IServiceConfig} message ServiceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.ServiceConfig} ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.ServiceConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.service = reader.string(); + break; + case 2: + message.timeoutSeconds = reader.int32(); + break; + case 13: + message.availableMemory = reader.string(); + break; + case 4: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.environmentVariables[key] = value; + break; + case 5: + message.maxInstanceCount = reader.int32(); + break; + case 12: + message.minInstanceCount = reader.int32(); + break; + case 6: + message.vpcConnector = reader.string(); + break; + case 7: + message.vpcConnectorEgressSettings = reader.int32(); + break; + case 8: + message.ingressSettings = reader.int32(); + break; + case 9: + message.uri = reader.string(); + break; + case 10: + message.serviceAccountEmail = reader.string(); + break; + case 16: + message.allTrafficOnLatestRevision = reader.bool(); + break; + case 17: + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v2beta.SecretEnvVar.decode(reader, reader.uint32())); + break; + case 19: + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v2beta.SecretVolume.decode(reader, reader.uint32())); + break; + case 18: + message.revision = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.ServiceConfig} ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceConfig message. + * @function verify + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.timeoutSeconds != null && message.hasOwnProperty("timeoutSeconds")) + if (!$util.isInteger(message.timeoutSeconds)) + return "timeoutSeconds: integer expected"; + if (message.availableMemory != null && message.hasOwnProperty("availableMemory")) + if (!$util.isString(message.availableMemory)) + return "availableMemory: string expected"; + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.maxInstanceCount != null && message.hasOwnProperty("maxInstanceCount")) + if (!$util.isInteger(message.maxInstanceCount)) + return "maxInstanceCount: integer expected"; + if (message.minInstanceCount != null && message.hasOwnProperty("minInstanceCount")) + if (!$util.isInteger(message.minInstanceCount)) + return "minInstanceCount: integer expected"; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + if (!$util.isString(message.vpcConnector)) + return "vpcConnector: string expected"; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + switch (message.vpcConnectorEgressSettings) { + default: + return "vpcConnectorEgressSettings: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + switch (message.ingressSettings) { + default: + return "ingressSettings: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.allTrafficOnLatestRevision != null && message.hasOwnProperty("allTrafficOnLatestRevision")) + if (typeof message.allTrafficOnLatestRevision !== "boolean") + return "allTrafficOnLatestRevision: boolean expected"; + if (message.secretEnvironmentVariables != null && message.hasOwnProperty("secretEnvironmentVariables")) { + if (!Array.isArray(message.secretEnvironmentVariables)) + return "secretEnvironmentVariables: array expected"; + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) { + var error = $root.google.cloud.functions.v2beta.SecretEnvVar.verify(message.secretEnvironmentVariables[i]); + if (error) + return "secretEnvironmentVariables." + error; + } + } + if (message.secretVolumes != null && message.hasOwnProperty("secretVolumes")) { + if (!Array.isArray(message.secretVolumes)) + return "secretVolumes: array expected"; + for (var i = 0; i < message.secretVolumes.length; ++i) { + var error = $root.google.cloud.functions.v2beta.SecretVolume.verify(message.secretVolumes[i]); + if (error) + return "secretVolumes." + error; + } + } + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isString(message.revision)) + return "revision: string expected"; + return null; + }; + + /** + * Creates a ServiceConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.ServiceConfig} ServiceConfig + */ + ServiceConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.ServiceConfig) + return object; + var message = new $root.google.cloud.functions.v2beta.ServiceConfig(); + if (object.service != null) + message.service = String(object.service); + if (object.timeoutSeconds != null) + message.timeoutSeconds = object.timeoutSeconds | 0; + if (object.availableMemory != null) + message.availableMemory = String(object.availableMemory); + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v2beta.ServiceConfig.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.maxInstanceCount != null) + message.maxInstanceCount = object.maxInstanceCount | 0; + if (object.minInstanceCount != null) + message.minInstanceCount = object.minInstanceCount | 0; + if (object.vpcConnector != null) + message.vpcConnector = String(object.vpcConnector); + switch (object.vpcConnectorEgressSettings) { + case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.vpcConnectorEgressSettings = 0; + break; + case "PRIVATE_RANGES_ONLY": + case 1: + message.vpcConnectorEgressSettings = 1; + break; + case "ALL_TRAFFIC": + case 2: + message.vpcConnectorEgressSettings = 2; + break; + } + switch (object.ingressSettings) { + case "INGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.ingressSettings = 0; + break; + case "ALLOW_ALL": + case 1: + message.ingressSettings = 1; + break; + case "ALLOW_INTERNAL_ONLY": + case 2: + message.ingressSettings = 2; + break; + case "ALLOW_INTERNAL_AND_GCLB": + case 3: + message.ingressSettings = 3; + break; + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + if (object.allTrafficOnLatestRevision != null) + message.allTrafficOnLatestRevision = Boolean(object.allTrafficOnLatestRevision); + if (object.secretEnvironmentVariables) { + if (!Array.isArray(object.secretEnvironmentVariables)) + throw TypeError(".google.cloud.functions.v2beta.ServiceConfig.secretEnvironmentVariables: array expected"); + message.secretEnvironmentVariables = []; + for (var i = 0; i < object.secretEnvironmentVariables.length; ++i) { + if (typeof object.secretEnvironmentVariables[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.ServiceConfig.secretEnvironmentVariables: object expected"); + message.secretEnvironmentVariables[i] = $root.google.cloud.functions.v2beta.SecretEnvVar.fromObject(object.secretEnvironmentVariables[i]); + } + } + if (object.secretVolumes) { + if (!Array.isArray(object.secretVolumes)) + throw TypeError(".google.cloud.functions.v2beta.ServiceConfig.secretVolumes: array expected"); + message.secretVolumes = []; + for (var i = 0; i < object.secretVolumes.length; ++i) { + if (typeof object.secretVolumes[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.ServiceConfig.secretVolumes: object expected"); + message.secretVolumes[i] = $root.google.cloud.functions.v2beta.SecretVolume.fromObject(object.secretVolumes[i]); + } + } + if (object.revision != null) + message.revision = String(object.revision); + return message; + }; + + /** + * Creates a plain object from a ServiceConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {google.cloud.functions.v2beta.ServiceConfig} message ServiceConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.secretEnvironmentVariables = []; + object.secretVolumes = []; + } + if (options.objects || options.defaults) + object.environmentVariables = {}; + if (options.defaults) { + object.service = ""; + object.timeoutSeconds = 0; + object.maxInstanceCount = 0; + object.vpcConnector = ""; + object.vpcConnectorEgressSettings = options.enums === String ? "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" : 0; + object.ingressSettings = options.enums === String ? "INGRESS_SETTINGS_UNSPECIFIED" : 0; + object.uri = ""; + object.serviceAccountEmail = ""; + object.minInstanceCount = 0; + object.availableMemory = ""; + object.allTrafficOnLatestRevision = false; + object.revision = ""; + } + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.timeoutSeconds != null && message.hasOwnProperty("timeoutSeconds")) + object.timeoutSeconds = message.timeoutSeconds; + var keys2; + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.maxInstanceCount != null && message.hasOwnProperty("maxInstanceCount")) + object.maxInstanceCount = message.maxInstanceCount; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + object.vpcConnector = message.vpcConnector; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2beta.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.minInstanceCount != null && message.hasOwnProperty("minInstanceCount")) + object.minInstanceCount = message.minInstanceCount; + if (message.availableMemory != null && message.hasOwnProperty("availableMemory")) + object.availableMemory = message.availableMemory; + if (message.allTrafficOnLatestRevision != null && message.hasOwnProperty("allTrafficOnLatestRevision")) + object.allTrafficOnLatestRevision = message.allTrafficOnLatestRevision; + if (message.secretEnvironmentVariables && message.secretEnvironmentVariables.length) { + object.secretEnvironmentVariables = []; + for (var j = 0; j < message.secretEnvironmentVariables.length; ++j) + object.secretEnvironmentVariables[j] = $root.google.cloud.functions.v2beta.SecretEnvVar.toObject(message.secretEnvironmentVariables[j], options); + } + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.secretVolumes && message.secretVolumes.length) { + object.secretVolumes = []; + for (var j = 0; j < message.secretVolumes.length; ++j) + object.secretVolumes[j] = $root.google.cloud.functions.v2beta.SecretVolume.toObject(message.secretVolumes[j], options); + } + return object; + }; + + /** + * Converts this ServiceConfig to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @instance + * @returns {Object.} JSON object + */ + ServiceConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * VpcConnectorEgressSettings enum. + * @name google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings + * @enum {number} + * @property {number} VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED=0 VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED value + * @property {number} PRIVATE_RANGES_ONLY=1 PRIVATE_RANGES_ONLY value + * @property {number} ALL_TRAFFIC=2 ALL_TRAFFIC value + */ + ServiceConfig.VpcConnectorEgressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIVATE_RANGES_ONLY"] = 1; + values[valuesById[2] = "ALL_TRAFFIC"] = 2; + return values; + })(); + + /** + * IngressSettings enum. + * @name google.cloud.functions.v2beta.ServiceConfig.IngressSettings + * @enum {number} + * @property {number} INGRESS_SETTINGS_UNSPECIFIED=0 INGRESS_SETTINGS_UNSPECIFIED value + * @property {number} ALLOW_ALL=1 ALLOW_ALL value + * @property {number} ALLOW_INTERNAL_ONLY=2 ALLOW_INTERNAL_ONLY value + * @property {number} ALLOW_INTERNAL_AND_GCLB=3 ALLOW_INTERNAL_AND_GCLB value + */ + ServiceConfig.IngressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALLOW_ALL"] = 1; + values[valuesById[2] = "ALLOW_INTERNAL_ONLY"] = 2; + values[valuesById[3] = "ALLOW_INTERNAL_AND_GCLB"] = 3; + return values; + })(); + + return ServiceConfig; + })(); + + v2beta.SecretEnvVar = (function() { + + /** + * Properties of a SecretEnvVar. + * @memberof google.cloud.functions.v2beta + * @interface ISecretEnvVar + * @property {string|null} [key] SecretEnvVar key + * @property {string|null} [projectId] SecretEnvVar projectId + * @property {string|null} [secret] SecretEnvVar secret + * @property {string|null} [version] SecretEnvVar version + */ + + /** + * Constructs a new SecretEnvVar. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a SecretEnvVar. + * @implements ISecretEnvVar + * @constructor + * @param {google.cloud.functions.v2beta.ISecretEnvVar=} [properties] Properties to set + */ + function SecretEnvVar(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretEnvVar key. + * @member {string} key + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.key = ""; + + /** + * SecretEnvVar projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.projectId = ""; + + /** + * SecretEnvVar secret. + * @member {string} secret + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.secret = ""; + + /** + * SecretEnvVar version. + * @member {string} version + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.version = ""; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {google.cloud.functions.v2beta.ISecretEnvVar=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.SecretEnvVar} SecretEnvVar instance + */ + SecretEnvVar.create = function create(properties) { + return new SecretEnvVar(properties); + }; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v2beta.SecretEnvVar.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {google.cloud.functions.v2beta.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.version); + return writer; + }; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.SecretEnvVar.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {google.cloud.functions.v2beta.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.SecretEnvVar(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretEnvVar message. + * @function verify + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretEnvVar.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.SecretEnvVar} SecretEnvVar + */ + SecretEnvVar.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.SecretEnvVar) + return object; + var message = new $root.google.cloud.functions.v2beta.SecretEnvVar(); + if (object.key != null) + message.key = String(object.key); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {google.cloud.functions.v2beta.SecretEnvVar} message SecretEnvVar + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretEnvVar.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = ""; + object.projectId = ""; + object.secret = ""; + object.version = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this SecretEnvVar to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @instance + * @returns {Object.} JSON object + */ + SecretEnvVar.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecretEnvVar; + })(); + + v2beta.SecretVolume = (function() { + + /** + * Properties of a SecretVolume. + * @memberof google.cloud.functions.v2beta + * @interface ISecretVolume + * @property {string|null} [mountPath] SecretVolume mountPath + * @property {string|null} [projectId] SecretVolume projectId + * @property {string|null} [secret] SecretVolume secret + * @property {Array.|null} [versions] SecretVolume versions + */ + + /** + * Constructs a new SecretVolume. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a SecretVolume. + * @implements ISecretVolume + * @constructor + * @param {google.cloud.functions.v2beta.ISecretVolume=} [properties] Properties to set + */ + function SecretVolume(properties) { + this.versions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretVolume mountPath. + * @member {string} mountPath + * @memberof google.cloud.functions.v2beta.SecretVolume + * @instance + */ + SecretVolume.prototype.mountPath = ""; + + /** + * SecretVolume projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2beta.SecretVolume + * @instance + */ + SecretVolume.prototype.projectId = ""; + + /** + * SecretVolume secret. + * @member {string} secret + * @memberof google.cloud.functions.v2beta.SecretVolume + * @instance + */ + SecretVolume.prototype.secret = ""; + + /** + * SecretVolume versions. + * @member {Array.} versions + * @memberof google.cloud.functions.v2beta.SecretVolume + * @instance + */ + SecretVolume.prototype.versions = $util.emptyArray; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {google.cloud.functions.v2beta.ISecretVolume=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.SecretVolume} SecretVolume instance + */ + SecretVolume.create = function create(properties) { + return new SecretVolume(properties); + }; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v2beta.SecretVolume.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {google.cloud.functions.v2beta.ISecretVolume} message SecretVolume message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVolume.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mountPath != null && Object.hasOwnProperty.call(message, "mountPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mountPath); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.google.cloud.functions.v2beta.SecretVolume.SecretVersion.encode(message.versions[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.SecretVolume.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {google.cloud.functions.v2beta.ISecretVolume} message SecretVolume message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVolume.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.SecretVolume} SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVolume.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.SecretVolume(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mountPath = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v2beta.SecretVolume.SecretVersion.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.SecretVolume} SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVolume.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretVolume message. + * @function verify + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretVolume.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + if (!$util.isString(message.mountPath)) + return "mountPath: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.google.cloud.functions.v2beta.SecretVolume.SecretVersion.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + return null; + }; + + /** + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.SecretVolume} SecretVolume + */ + SecretVolume.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.SecretVolume) + return object; + var message = new $root.google.cloud.functions.v2beta.SecretVolume(); + if (object.mountPath != null) + message.mountPath = String(object.mountPath); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".google.cloud.functions.v2beta.SecretVolume.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.SecretVolume.versions: object expected"); + message.versions[i] = $root.google.cloud.functions.v2beta.SecretVolume.SecretVersion.fromObject(object.versions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {google.cloud.functions.v2beta.SecretVolume} message SecretVolume + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretVolume.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) { + object.mountPath = ""; + object.projectId = ""; + object.secret = ""; + } + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + object.mountPath = message.mountPath; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.google.cloud.functions.v2beta.SecretVolume.SecretVersion.toObject(message.versions[j], options); + } + return object; + }; + + /** + * Converts this SecretVolume to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.SecretVolume + * @instance + * @returns {Object.} JSON object + */ + SecretVolume.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SecretVolume.SecretVersion = (function() { + + /** + * Properties of a SecretVersion. + * @memberof google.cloud.functions.v2beta.SecretVolume + * @interface ISecretVersion + * @property {string|null} [version] SecretVersion version + * @property {string|null} [path] SecretVersion path + */ + + /** + * Constructs a new SecretVersion. + * @memberof google.cloud.functions.v2beta.SecretVolume + * @classdesc Represents a SecretVersion. + * @implements ISecretVersion + * @constructor + * @param {google.cloud.functions.v2beta.SecretVolume.ISecretVersion=} [properties] Properties to set + */ + function SecretVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretVersion version. + * @member {string} version + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.version = ""; + + /** + * SecretVersion path. + * @member {string} path + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.path = ""; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2beta.SecretVolume.ISecretVersion=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.SecretVolume.SecretVersion} SecretVersion instance + */ + SecretVersion.create = function create(properties) { + return new SecretVersion(properties); + }; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v2beta.SecretVolume.SecretVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2beta.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.SecretVolume.SecretVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2beta.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.SecretVolume.SecretVersion} SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.SecretVolume.SecretVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.SecretVolume.SecretVersion} SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretVersion message. + * @function verify + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.SecretVolume.SecretVersion} SecretVersion + */ + SecretVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.SecretVolume.SecretVersion) + return object; + var message = new $root.google.cloud.functions.v2beta.SecretVolume.SecretVersion(); + if (object.version != null) + message.version = String(object.version); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2beta.SecretVolume.SecretVersion} message SecretVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = ""; + object.path = ""; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this SecretVersion to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @instance + * @returns {Object.} JSON object + */ + SecretVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecretVersion; + })(); + + return SecretVolume; + })(); + + v2beta.EventTrigger = (function() { + + /** + * Properties of an EventTrigger. + * @memberof google.cloud.functions.v2beta + * @interface IEventTrigger + * @property {string|null} [trigger] EventTrigger trigger + * @property {string|null} [triggerRegion] EventTrigger triggerRegion + * @property {string|null} [eventType] EventTrigger eventType + * @property {Array.|null} [eventFilters] EventTrigger eventFilters + * @property {string|null} [pubsubTopic] EventTrigger pubsubTopic + * @property {string|null} [serviceAccountEmail] EventTrigger serviceAccountEmail + * @property {google.cloud.functions.v2beta.EventTrigger.RetryPolicy|null} [retryPolicy] EventTrigger retryPolicy + * @property {string|null} [channel] EventTrigger channel + */ + + /** + * Constructs a new EventTrigger. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents an EventTrigger. + * @implements IEventTrigger + * @constructor + * @param {google.cloud.functions.v2beta.IEventTrigger=} [properties] Properties to set + */ + function EventTrigger(properties) { + this.eventFilters = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventTrigger trigger. + * @member {string} trigger + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + */ + EventTrigger.prototype.trigger = ""; + + /** + * EventTrigger triggerRegion. + * @member {string} triggerRegion + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + */ + EventTrigger.prototype.triggerRegion = ""; + + /** + * EventTrigger eventType. + * @member {string} eventType + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + */ + EventTrigger.prototype.eventType = ""; + + /** + * EventTrigger eventFilters. + * @member {Array.} eventFilters + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + */ + EventTrigger.prototype.eventFilters = $util.emptyArray; + + /** + * EventTrigger pubsubTopic. + * @member {string} pubsubTopic + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + */ + EventTrigger.prototype.pubsubTopic = ""; + + /** + * EventTrigger serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + */ + EventTrigger.prototype.serviceAccountEmail = ""; + + /** + * EventTrigger retryPolicy. + * @member {google.cloud.functions.v2beta.EventTrigger.RetryPolicy} retryPolicy + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + */ + EventTrigger.prototype.retryPolicy = 0; + + /** + * EventTrigger channel. + * @member {string} channel + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + */ + EventTrigger.prototype.channel = ""; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {google.cloud.functions.v2beta.IEventTrigger=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.EventTrigger} EventTrigger instance + */ + EventTrigger.create = function create(properties) { + return new EventTrigger(properties); + }; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v2beta.EventTrigger.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {google.cloud.functions.v2beta.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.trigger); + if (message.triggerRegion != null && Object.hasOwnProperty.call(message, "triggerRegion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerRegion); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.eventType); + if (message.eventFilters != null && message.eventFilters.length) + for (var i = 0; i < message.eventFilters.length; ++i) + $root.google.cloud.functions.v2beta.EventFilter.encode(message.eventFilters[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pubsubTopic != null && Object.hasOwnProperty.call(message, "pubsubTopic")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pubsubTopic); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.serviceAccountEmail); + if (message.retryPolicy != null && Object.hasOwnProperty.call(message, "retryPolicy")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.retryPolicy); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.channel); + return writer; + }; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.EventTrigger.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {google.cloud.functions.v2beta.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.EventTrigger(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.trigger = reader.string(); + break; + case 2: + message.triggerRegion = reader.string(); + break; + case 3: + message.eventType = reader.string(); + break; + case 4: + if (!(message.eventFilters && message.eventFilters.length)) + message.eventFilters = []; + message.eventFilters.push($root.google.cloud.functions.v2beta.EventFilter.decode(reader, reader.uint32())); + break; + case 5: + message.pubsubTopic = reader.string(); + break; + case 6: + message.serviceAccountEmail = reader.string(); + break; + case 7: + message.retryPolicy = reader.int32(); + break; + case 8: + message.channel = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventTrigger message. + * @function verify + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventTrigger.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) + if (!$util.isString(message.trigger)) + return "trigger: string expected"; + if (message.triggerRegion != null && message.hasOwnProperty("triggerRegion")) + if (!$util.isString(message.triggerRegion)) + return "triggerRegion: string expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.eventFilters != null && message.hasOwnProperty("eventFilters")) { + if (!Array.isArray(message.eventFilters)) + return "eventFilters: array expected"; + for (var i = 0; i < message.eventFilters.length; ++i) { + var error = $root.google.cloud.functions.v2beta.EventFilter.verify(message.eventFilters[i]); + if (error) + return "eventFilters." + error; + } + } + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) + if (!$util.isString(message.pubsubTopic)) + return "pubsubTopic: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) + switch (message.retryPolicy) { + default: + return "retryPolicy: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.channel != null && message.hasOwnProperty("channel")) + if (!$util.isString(message.channel)) + return "channel: string expected"; + return null; + }; + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.EventTrigger} EventTrigger + */ + EventTrigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.EventTrigger) + return object; + var message = new $root.google.cloud.functions.v2beta.EventTrigger(); + if (object.trigger != null) + message.trigger = String(object.trigger); + if (object.triggerRegion != null) + message.triggerRegion = String(object.triggerRegion); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.eventFilters) { + if (!Array.isArray(object.eventFilters)) + throw TypeError(".google.cloud.functions.v2beta.EventTrigger.eventFilters: array expected"); + message.eventFilters = []; + for (var i = 0; i < object.eventFilters.length; ++i) { + if (typeof object.eventFilters[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.EventTrigger.eventFilters: object expected"); + message.eventFilters[i] = $root.google.cloud.functions.v2beta.EventFilter.fromObject(object.eventFilters[i]); + } + } + if (object.pubsubTopic != null) + message.pubsubTopic = String(object.pubsubTopic); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + switch (object.retryPolicy) { + case "RETRY_POLICY_UNSPECIFIED": + case 0: + message.retryPolicy = 0; + break; + case "RETRY_POLICY_DO_NOT_RETRY": + case 1: + message.retryPolicy = 1; + break; + case "RETRY_POLICY_RETRY": + case 2: + message.retryPolicy = 2; + break; + } + if (object.channel != null) + message.channel = String(object.channel); + return message; + }; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {google.cloud.functions.v2beta.EventTrigger} message EventTrigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventTrigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.eventFilters = []; + if (options.defaults) { + object.trigger = ""; + object.triggerRegion = ""; + object.eventType = ""; + object.pubsubTopic = ""; + object.serviceAccountEmail = ""; + object.retryPolicy = options.enums === String ? "RETRY_POLICY_UNSPECIFIED" : 0; + object.channel = ""; + } + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = message.trigger; + if (message.triggerRegion != null && message.hasOwnProperty("triggerRegion")) + object.triggerRegion = message.triggerRegion; + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.eventFilters && message.eventFilters.length) { + object.eventFilters = []; + for (var j = 0; j < message.eventFilters.length; ++j) + object.eventFilters[j] = $root.google.cloud.functions.v2beta.EventFilter.toObject(message.eventFilters[j], options); + } + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) + object.pubsubTopic = message.pubsubTopic; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) + object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2beta.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = message.channel; + return object; + }; + + /** + * Converts this EventTrigger to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.EventTrigger + * @instance + * @returns {Object.} JSON object + */ + EventTrigger.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * RetryPolicy enum. + * @name google.cloud.functions.v2beta.EventTrigger.RetryPolicy + * @enum {number} + * @property {number} RETRY_POLICY_UNSPECIFIED=0 RETRY_POLICY_UNSPECIFIED value + * @property {number} RETRY_POLICY_DO_NOT_RETRY=1 RETRY_POLICY_DO_NOT_RETRY value + * @property {number} RETRY_POLICY_RETRY=2 RETRY_POLICY_RETRY value + */ + EventTrigger.RetryPolicy = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETRY_POLICY_UNSPECIFIED"] = 0; + values[valuesById[1] = "RETRY_POLICY_DO_NOT_RETRY"] = 1; + values[valuesById[2] = "RETRY_POLICY_RETRY"] = 2; + return values; + })(); + + return EventTrigger; + })(); + + v2beta.EventFilter = (function() { + + /** + * Properties of an EventFilter. + * @memberof google.cloud.functions.v2beta + * @interface IEventFilter + * @property {string|null} [attribute] EventFilter attribute + * @property {string|null} [value] EventFilter value + * @property {string|null} [operator] EventFilter operator + */ + + /** + * Constructs a new EventFilter. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents an EventFilter. + * @implements IEventFilter + * @constructor + * @param {google.cloud.functions.v2beta.IEventFilter=} [properties] Properties to set + */ + function EventFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventFilter attribute. + * @member {string} attribute + * @memberof google.cloud.functions.v2beta.EventFilter + * @instance + */ + EventFilter.prototype.attribute = ""; + + /** + * EventFilter value. + * @member {string} value + * @memberof google.cloud.functions.v2beta.EventFilter + * @instance + */ + EventFilter.prototype.value = ""; + + /** + * EventFilter operator. + * @member {string} operator + * @memberof google.cloud.functions.v2beta.EventFilter + * @instance + */ + EventFilter.prototype.operator = ""; + + /** + * Creates a new EventFilter instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {google.cloud.functions.v2beta.IEventFilter=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.EventFilter} EventFilter instance + */ + EventFilter.create = function create(properties) { + return new EventFilter(properties); + }; + + /** + * Encodes the specified EventFilter message. Does not implicitly {@link google.cloud.functions.v2beta.EventFilter.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {google.cloud.functions.v2beta.IEventFilter} message EventFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventFilter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attribute != null && Object.hasOwnProperty.call(message, "attribute")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attribute); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.operator != null && Object.hasOwnProperty.call(message, "operator")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.operator); + return writer; + }; + + /** + * Encodes the specified EventFilter message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.EventFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {google.cloud.functions.v2beta.IEventFilter} message EventFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventFilter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.EventFilter} EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventFilter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.EventFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attribute = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + case 3: + message.operator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.EventFilter} EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventFilter message. + * @function verify + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventFilter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attribute != null && message.hasOwnProperty("attribute")) + if (!$util.isString(message.attribute)) + return "attribute: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.operator != null && message.hasOwnProperty("operator")) + if (!$util.isString(message.operator)) + return "operator: string expected"; + return null; + }; + + /** + * Creates an EventFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.EventFilter} EventFilter + */ + EventFilter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.EventFilter) + return object; + var message = new $root.google.cloud.functions.v2beta.EventFilter(); + if (object.attribute != null) + message.attribute = String(object.attribute); + if (object.value != null) + message.value = String(object.value); + if (object.operator != null) + message.operator = String(object.operator); + return message; + }; + + /** + * Creates a plain object from an EventFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {google.cloud.functions.v2beta.EventFilter} message EventFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventFilter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attribute = ""; + object.value = ""; + object.operator = ""; + } + if (message.attribute != null && message.hasOwnProperty("attribute")) + object.attribute = message.attribute; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.operator != null && message.hasOwnProperty("operator")) + object.operator = message.operator; + return object; + }; + + /** + * Converts this EventFilter to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.EventFilter + * @instance + * @returns {Object.} JSON object + */ + EventFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventFilter; + })(); + + v2beta.GetFunctionRequest = (function() { + + /** + * Properties of a GetFunctionRequest. + * @memberof google.cloud.functions.v2beta + * @interface IGetFunctionRequest + * @property {string|null} [name] GetFunctionRequest name + */ + + /** + * Constructs a new GetFunctionRequest. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a GetFunctionRequest. + * @implements IGetFunctionRequest + * @constructor + * @param {google.cloud.functions.v2beta.IGetFunctionRequest=} [properties] Properties to set + */ + function GetFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @instance + */ + GetFunctionRequest.prototype.name = ""; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IGetFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.GetFunctionRequest} GetFunctionRequest instance + */ + GetFunctionRequest.create = function create(properties) { + return new GetFunctionRequest(properties); + }; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2beta.GetFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GetFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.GetFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.GetFunctionRequest} GetFunctionRequest + */ + GetFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.GetFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2beta.GetFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.GetFunctionRequest} message GetFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + GetFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetFunctionRequest; + })(); + + v2beta.ListFunctionsRequest = (function() { + + /** + * Properties of a ListFunctionsRequest. + * @memberof google.cloud.functions.v2beta + * @interface IListFunctionsRequest + * @property {string|null} [parent] ListFunctionsRequest parent + * @property {number|null} [pageSize] ListFunctionsRequest pageSize + * @property {string|null} [pageToken] ListFunctionsRequest pageToken + * @property {string|null} [filter] ListFunctionsRequest filter + * @property {string|null} [orderBy] ListFunctionsRequest orderBy + */ + + /** + * Constructs a new ListFunctionsRequest. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a ListFunctionsRequest. + * @implements IListFunctionsRequest + * @constructor + * @param {google.cloud.functions.v2beta.IListFunctionsRequest=} [properties] Properties to set + */ + function ListFunctionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFunctionsRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.parent = ""; + + /** + * ListFunctionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageSize = 0; + + /** + * ListFunctionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageToken = ""; + + /** + * ListFunctionsRequest filter. + * @member {string} filter + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.filter = ""; + + /** + * ListFunctionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2beta.IListFunctionsRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.ListFunctionsRequest} ListFunctionsRequest instance + */ + ListFunctionsRequest.create = function create(properties) { + return new ListFunctionsRequest(properties); + }; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v2beta.ListFunctionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2beta.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListFunctionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2beta.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.ListFunctionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + case 5: + message.orderBy = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsRequest message. + * @function verify + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.ListFunctionsRequest} ListFunctionsRequest + */ + ListFunctionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.ListFunctionsRequest) + return object; + var message = new $root.google.cloud.functions.v2beta.ListFunctionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2beta.ListFunctionsRequest} message ListFunctionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsRequest; + })(); + + v2beta.ListFunctionsResponse = (function() { + + /** + * Properties of a ListFunctionsResponse. + * @memberof google.cloud.functions.v2beta + * @interface IListFunctionsResponse + * @property {Array.|null} [functions] ListFunctionsResponse functions + * @property {string|null} [nextPageToken] ListFunctionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListFunctionsResponse unreachable + */ + + /** + * Constructs a new ListFunctionsResponse. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a ListFunctionsResponse. + * @implements IListFunctionsResponse + * @constructor + * @param {google.cloud.functions.v2beta.IListFunctionsResponse=} [properties] Properties to set + */ + function ListFunctionsResponse(properties) { + this.functions = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFunctionsResponse functions. + * @member {Array.} functions + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.functions = $util.emptyArray; + + /** + * ListFunctionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.nextPageToken = ""; + + /** + * ListFunctionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2beta.IListFunctionsResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.ListFunctionsResponse} ListFunctionsResponse instance + */ + ListFunctionsResponse.create = function create(properties) { + return new ListFunctionsResponse(properties); + }; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v2beta.ListFunctionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2beta.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.functions != null && message.functions.length) + for (var i = 0; i < message.functions.length; ++i) + $root.google.cloud.functions.v2beta.Function.encode(message.functions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListFunctionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2beta.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.ListFunctionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsResponse message. + * @function verify + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.functions != null && message.hasOwnProperty("functions")) { + if (!Array.isArray(message.functions)) + return "functions: array expected"; + for (var i = 0; i < message.functions.length; ++i) { + var error = $root.google.cloud.functions.v2beta.Function.verify(message.functions[i]); + if (error) + return "functions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.ListFunctionsResponse} ListFunctionsResponse + */ + ListFunctionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.ListFunctionsResponse) + return object; + var message = new $root.google.cloud.functions.v2beta.ListFunctionsResponse(); + if (object.functions) { + if (!Array.isArray(object.functions)) + throw TypeError(".google.cloud.functions.v2beta.ListFunctionsResponse.functions: array expected"); + message.functions = []; + for (var i = 0; i < object.functions.length; ++i) { + if (typeof object.functions[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.ListFunctionsResponse.functions: object expected"); + message.functions[i] = $root.google.cloud.functions.v2beta.Function.fromObject(object.functions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.functions.v2beta.ListFunctionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2beta.ListFunctionsResponse} message ListFunctionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.functions = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.functions && message.functions.length) { + object.functions = []; + for (var j = 0; j < message.functions.length; ++j) + object.functions[j] = $root.google.cloud.functions.v2beta.Function.toObject(message.functions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsResponse; + })(); + + v2beta.CreateFunctionRequest = (function() { + + /** + * Properties of a CreateFunctionRequest. + * @memberof google.cloud.functions.v2beta + * @interface ICreateFunctionRequest + * @property {string|null} [parent] CreateFunctionRequest parent + * @property {google.cloud.functions.v2beta.IFunction|null} ["function"] CreateFunctionRequest function + * @property {string|null} [functionId] CreateFunctionRequest functionId + */ + + /** + * Constructs a new CreateFunctionRequest. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a CreateFunctionRequest. + * @implements ICreateFunctionRequest + * @constructor + * @param {google.cloud.functions.v2beta.ICreateFunctionRequest=} [properties] Properties to set + */ + function CreateFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateFunctionRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.parent = ""; + + /** + * CreateFunctionRequest function. + * @member {google.cloud.functions.v2beta.IFunction|null|undefined} function + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype["function"] = null; + + /** + * CreateFunctionRequest functionId. + * @member {string} functionId + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.functionId = ""; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.ICreateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.CreateFunctionRequest} CreateFunctionRequest instance + */ + CreateFunctionRequest.create = function create(properties) { + return new CreateFunctionRequest(properties); + }; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2beta.CreateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v2beta.Function.encode(message["function"], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.functionId != null && Object.hasOwnProperty.call(message, "functionId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.functionId); + return writer; + }; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.CreateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.CreateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message["function"] = $root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32()); + break; + case 3: + message.functionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v2beta.Function.verify(message["function"]); + if (error) + return "function." + error; + } + if (message.functionId != null && message.hasOwnProperty("functionId")) + if (!$util.isString(message.functionId)) + return "functionId: string expected"; + return null; + }; + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.CreateFunctionRequest} CreateFunctionRequest + */ + CreateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.CreateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2beta.CreateFunctionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v2beta.CreateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v2beta.Function.fromObject(object["function"]); + } + if (object.functionId != null) + message.functionId = String(object.functionId); + return message; + }; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.CreateFunctionRequest} message CreateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object["function"] = null; + object.functionId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v2beta.Function.toObject(message["function"], options); + if (message.functionId != null && message.hasOwnProperty("functionId")) + object.functionId = message.functionId; + return object; + }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateFunctionRequest; + })(); + + v2beta.UpdateFunctionRequest = (function() { + + /** + * Properties of an UpdateFunctionRequest. + * @memberof google.cloud.functions.v2beta + * @interface IUpdateFunctionRequest + * @property {google.cloud.functions.v2beta.IFunction|null} ["function"] UpdateFunctionRequest function + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFunctionRequest updateMask + */ + + /** + * Constructs a new UpdateFunctionRequest. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents an UpdateFunctionRequest. + * @implements IUpdateFunctionRequest + * @constructor + * @param {google.cloud.functions.v2beta.IUpdateFunctionRequest=} [properties] Properties to set + */ + function UpdateFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateFunctionRequest function. + * @member {google.cloud.functions.v2beta.IFunction|null|undefined} function + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype["function"] = null; + + /** + * UpdateFunctionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IUpdateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.UpdateFunctionRequest} UpdateFunctionRequest instance + */ + UpdateFunctionRequest.create = function create(properties) { + return new UpdateFunctionRequest(properties); + }; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2beta.UpdateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v2beta.Function.encode(message["function"], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.UpdateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.UpdateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["function"] = $root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v2beta.Function.verify(message["function"]); + if (error) + return "function." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.UpdateFunctionRequest} UpdateFunctionRequest + */ + UpdateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.UpdateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2beta.UpdateFunctionRequest(); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v2beta.UpdateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v2beta.Function.fromObject(object["function"]); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.functions.v2beta.UpdateFunctionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.UpdateFunctionRequest} message UpdateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object["function"] = null; + object.updateMask = null; + } + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v2beta.Function.toObject(message["function"], options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateFunctionRequest; + })(); + + v2beta.DeleteFunctionRequest = (function() { + + /** + * Properties of a DeleteFunctionRequest. + * @memberof google.cloud.functions.v2beta + * @interface IDeleteFunctionRequest + * @property {string|null} [name] DeleteFunctionRequest name + */ + + /** + * Constructs a new DeleteFunctionRequest. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a DeleteFunctionRequest. + * @implements IDeleteFunctionRequest + * @constructor + * @param {google.cloud.functions.v2beta.IDeleteFunctionRequest=} [properties] Properties to set + */ + function DeleteFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @instance + */ + DeleteFunctionRequest.prototype.name = ""; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IDeleteFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.DeleteFunctionRequest} DeleteFunctionRequest instance + */ + DeleteFunctionRequest.create = function create(properties) { + return new DeleteFunctionRequest(properties); + }; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2beta.DeleteFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.DeleteFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.DeleteFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.DeleteFunctionRequest} DeleteFunctionRequest + */ + DeleteFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.DeleteFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2beta.DeleteFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2beta.DeleteFunctionRequest} message DeleteFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteFunctionRequest; + })(); + + v2beta.GenerateUploadUrlRequest = (function() { + + /** + * Properties of a GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v2beta + * @interface IGenerateUploadUrlRequest + * @property {string|null} [parent] GenerateUploadUrlRequest parent + */ + + /** + * Constructs a new GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a GenerateUploadUrlRequest. + * @implements IGenerateUploadUrlRequest + * @constructor + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlRequest=} [properties] Properties to set + */ + function GenerateUploadUrlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateUploadUrlRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @instance + */ + GenerateUploadUrlRequest.prototype.parent = ""; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.GenerateUploadUrlRequest} GenerateUploadUrlRequest instance + */ + GenerateUploadUrlRequest.create = function create(properties) { + return new GenerateUploadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2beta.GenerateUploadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GenerateUploadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.GenerateUploadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.GenerateUploadUrlRequest} GenerateUploadUrlRequest + */ + GenerateUploadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.GenerateUploadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v2beta.GenerateUploadUrlRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2beta.GenerateUploadUrlRequest} message GenerateUploadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlRequest; + })(); + + v2beta.GenerateUploadUrlResponse = (function() { + + /** + * Properties of a GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v2beta + * @interface IGenerateUploadUrlResponse + * @property {string|null} [uploadUrl] GenerateUploadUrlResponse uploadUrl + * @property {google.cloud.functions.v2beta.IStorageSource|null} [storageSource] GenerateUploadUrlResponse storageSource + */ + + /** + * Constructs a new GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a GenerateUploadUrlResponse. + * @implements IGenerateUploadUrlResponse + * @constructor + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlResponse=} [properties] Properties to set + */ + function GenerateUploadUrlResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateUploadUrlResponse uploadUrl. + * @member {string} uploadUrl + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.uploadUrl = ""; + + /** + * GenerateUploadUrlResponse storageSource. + * @member {google.cloud.functions.v2beta.IStorageSource|null|undefined} storageSource + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.storageSource = null; + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.GenerateUploadUrlResponse} GenerateUploadUrlResponse instance + */ + GenerateUploadUrlResponse.create = function create(properties) { + return new GenerateUploadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2beta.GenerateUploadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uploadUrl != null && Object.hasOwnProperty.call(message, "uploadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uploadUrl); + if (message.storageSource != null && Object.hasOwnProperty.call(message, "storageSource")) + $root.google.cloud.functions.v2beta.StorageSource.encode(message.storageSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GenerateUploadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2beta.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.GenerateUploadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uploadUrl = reader.string(); + break; + case 2: + message.storageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + if (!$util.isString(message.uploadUrl)) + return "uploadUrl: string expected"; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + var error = $root.google.cloud.functions.v2beta.StorageSource.verify(message.storageSource); + if (error) + return "storageSource." + error; + } + return null; + }; + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.GenerateUploadUrlResponse} GenerateUploadUrlResponse + */ + GenerateUploadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.GenerateUploadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v2beta.GenerateUploadUrlResponse(); + if (object.uploadUrl != null) + message.uploadUrl = String(object.uploadUrl); + if (object.storageSource != null) { + if (typeof object.storageSource !== "object") + throw TypeError(".google.cloud.functions.v2beta.GenerateUploadUrlResponse.storageSource: object expected"); + message.storageSource = $root.google.cloud.functions.v2beta.StorageSource.fromObject(object.storageSource); + } + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2beta.GenerateUploadUrlResponse} message GenerateUploadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uploadUrl = ""; + object.storageSource = null; + } + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + object.uploadUrl = message.uploadUrl; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) + object.storageSource = $root.google.cloud.functions.v2beta.StorageSource.toObject(message.storageSource, options); + return object; + }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlResponse; + })(); + + v2beta.GenerateDownloadUrlRequest = (function() { + + /** + * Properties of a GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v2beta + * @interface IGenerateDownloadUrlRequest + * @property {string|null} [name] GenerateDownloadUrlRequest name + */ + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a GenerateDownloadUrlRequest. + * @implements IGenerateDownloadUrlRequest + * @constructor + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlRequest=} [properties] Properties to set + */ + function GenerateDownloadUrlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateDownloadUrlRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @instance + */ + GenerateDownloadUrlRequest.prototype.name = ""; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest instance + */ + GenerateDownloadUrlRequest.create = function create(properties) { + return new GenerateDownloadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2beta.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.GenerateDownloadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + */ + GenerateDownloadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.GenerateDownloadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v2beta.GenerateDownloadUrlRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2beta.GenerateDownloadUrlRequest} message GenerateDownloadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlRequest; + })(); + + v2beta.GenerateDownloadUrlResponse = (function() { + + /** + * Properties of a GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v2beta + * @interface IGenerateDownloadUrlResponse + * @property {string|null} [downloadUrl] GenerateDownloadUrlResponse downloadUrl + */ + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a GenerateDownloadUrlResponse. + * @implements IGenerateDownloadUrlResponse + * @constructor + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlResponse=} [properties] Properties to set + */ + function GenerateDownloadUrlResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateDownloadUrlResponse downloadUrl. + * @member {string} downloadUrl + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @instance + */ + GenerateDownloadUrlResponse.prototype.downloadUrl = ""; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse instance + */ + GenerateDownloadUrlResponse.create = function create(properties) { + return new GenerateDownloadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2beta.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.downloadUrl != null && Object.hasOwnProperty.call(message, "downloadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.downloadUrl); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2beta.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.GenerateDownloadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.downloadUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + if (!$util.isString(message.downloadUrl)) + return "downloadUrl: string expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + */ + GenerateDownloadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.GenerateDownloadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v2beta.GenerateDownloadUrlResponse(); + if (object.downloadUrl != null) + message.downloadUrl = String(object.downloadUrl); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2beta.GenerateDownloadUrlResponse} message GenerateDownloadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.downloadUrl = ""; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + object.downloadUrl = message.downloadUrl; + return object; + }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlResponse; + })(); + + v2beta.ListRuntimesRequest = (function() { + + /** + * Properties of a ListRuntimesRequest. + * @memberof google.cloud.functions.v2beta + * @interface IListRuntimesRequest + * @property {string|null} [parent] ListRuntimesRequest parent + * @property {string|null} [filter] ListRuntimesRequest filter + */ + + /** + * Constructs a new ListRuntimesRequest. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a ListRuntimesRequest. + * @implements IListRuntimesRequest + * @constructor + * @param {google.cloud.functions.v2beta.IListRuntimesRequest=} [properties] Properties to set + */ + function ListRuntimesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRuntimesRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @instance + */ + ListRuntimesRequest.prototype.parent = ""; + + /** + * ListRuntimesRequest filter. + * @member {string} filter + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @instance + */ + ListRuntimesRequest.prototype.filter = ""; + + /** + * Creates a new ListRuntimesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2beta.IListRuntimesRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.ListRuntimesRequest} ListRuntimesRequest instance + */ + ListRuntimesRequest.create = function create(properties) { + return new ListRuntimesRequest(properties); + }; + + /** + * Encodes the specified ListRuntimesRequest message. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2beta.IListRuntimesRequest} message ListRuntimesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListRuntimesRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2beta.IListRuntimesRequest} message ListRuntimesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.ListRuntimesRequest} ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.ListRuntimesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.ListRuntimesRequest} ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimesRequest message. + * @function verify + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListRuntimesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.ListRuntimesRequest} ListRuntimesRequest + */ + ListRuntimesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.ListRuntimesRequest) + return object; + var message = new $root.google.cloud.functions.v2beta.ListRuntimesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListRuntimesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2beta.ListRuntimesRequest} message ListRuntimesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListRuntimesRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @instance + * @returns {Object.} JSON object + */ + ListRuntimesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListRuntimesRequest; + })(); + + v2beta.ListRuntimesResponse = (function() { + + /** + * Properties of a ListRuntimesResponse. + * @memberof google.cloud.functions.v2beta + * @interface IListRuntimesResponse + * @property {Array.|null} [runtimes] ListRuntimesResponse runtimes + */ + + /** + * Constructs a new ListRuntimesResponse. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a ListRuntimesResponse. + * @implements IListRuntimesResponse + * @constructor + * @param {google.cloud.functions.v2beta.IListRuntimesResponse=} [properties] Properties to set + */ + function ListRuntimesResponse(properties) { + this.runtimes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRuntimesResponse runtimes. + * @member {Array.} runtimes + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @instance + */ + ListRuntimesResponse.prototype.runtimes = $util.emptyArray; + + /** + * Creates a new ListRuntimesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2beta.IListRuntimesResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.ListRuntimesResponse} ListRuntimesResponse instance + */ + ListRuntimesResponse.create = function create(properties) { + return new ListRuntimesResponse(properties); + }; + + /** + * Encodes the specified ListRuntimesResponse message. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2beta.IListRuntimesResponse} message ListRuntimesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.runtimes != null && message.runtimes.length) + for (var i = 0; i < message.runtimes.length; ++i) + $root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.encode(message.runtimes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListRuntimesResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2beta.IListRuntimesResponse} message ListRuntimesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.ListRuntimesResponse} ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.ListRuntimesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.runtimes && message.runtimes.length)) + message.runtimes = []; + message.runtimes.push($root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.ListRuntimesResponse} ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimesResponse message. + * @function verify + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.runtimes != null && message.hasOwnProperty("runtimes")) { + if (!Array.isArray(message.runtimes)) + return "runtimes: array expected"; + for (var i = 0; i < message.runtimes.length; ++i) { + var error = $root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.verify(message.runtimes[i]); + if (error) + return "runtimes." + error; + } + } + return null; + }; + + /** + * Creates a ListRuntimesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.ListRuntimesResponse} ListRuntimesResponse + */ + ListRuntimesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.ListRuntimesResponse) + return object; + var message = new $root.google.cloud.functions.v2beta.ListRuntimesResponse(); + if (object.runtimes) { + if (!Array.isArray(object.runtimes)) + throw TypeError(".google.cloud.functions.v2beta.ListRuntimesResponse.runtimes: array expected"); + message.runtimes = []; + for (var i = 0; i < object.runtimes.length; ++i) { + if (typeof object.runtimes[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.ListRuntimesResponse.runtimes: object expected"); + message.runtimes[i] = $root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.fromObject(object.runtimes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListRuntimesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2beta.ListRuntimesResponse} message ListRuntimesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.runtimes = []; + if (message.runtimes && message.runtimes.length) { + object.runtimes = []; + for (var j = 0; j < message.runtimes.length; ++j) + object.runtimes[j] = $root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.toObject(message.runtimes[j], options); + } + return object; + }; + + /** + * Converts this ListRuntimesResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @instance + * @returns {Object.} JSON object + */ + ListRuntimesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ListRuntimesResponse.Runtime = (function() { + + /** + * Properties of a Runtime. + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @interface IRuntime + * @property {string|null} [name] Runtime name + * @property {string|null} [displayName] Runtime displayName + * @property {google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage|null} [stage] Runtime stage + * @property {Array.|null} [warnings] Runtime warnings + * @property {google.cloud.functions.v2beta.Environment|null} [environment] Runtime environment + */ + + /** + * Constructs a new Runtime. + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @classdesc Represents a Runtime. + * @implements IRuntime + * @constructor + * @param {google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime=} [properties] Properties to set + */ + function Runtime(properties) { + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Runtime name. + * @member {string} name + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.name = ""; + + /** + * Runtime displayName. + * @member {string} displayName + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.displayName = ""; + + /** + * Runtime stage. + * @member {google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage} stage + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.stage = 0; + + /** + * Runtime warnings. + * @member {Array.} warnings + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.warnings = $util.emptyArray; + + /** + * Runtime environment. + * @member {google.cloud.functions.v2beta.Environment} environment + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.environment = 0; + + /** + * Creates a new Runtime instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.ListRuntimesResponse.Runtime} Runtime instance + */ + Runtime.create = function create(properties) { + return new Runtime(properties); + }; + + /** + * Encodes the specified Runtime message. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime} message Runtime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Runtime.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.stage != null && Object.hasOwnProperty.call(message, "stage")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.stage); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.warnings[i]); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.environment); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.displayName); + return writer; + }; + + /** + * Encodes the specified Runtime message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2beta.ListRuntimesResponse.IRuntime} message Runtime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Runtime.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Runtime message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.ListRuntimesResponse.Runtime} Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Runtime.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 5: + message.displayName = reader.string(); + break; + case 2: + message.stage = reader.int32(); + break; + case 3: + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push(reader.string()); + break; + case 4: + message.environment = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Runtime message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.ListRuntimesResponse.Runtime} Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Runtime.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Runtime message. + * @function verify + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Runtime.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.stage != null && message.hasOwnProperty("stage")) + switch (message.stage) { + default: + return "stage: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) + if (!$util.isString(message.warnings[i])) + return "warnings: string[] expected"; + } + if (message.environment != null && message.hasOwnProperty("environment")) + switch (message.environment) { + default: + return "environment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a Runtime message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.ListRuntimesResponse.Runtime} Runtime + */ + Runtime.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime) + return object; + var message = new $root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.stage) { + case "RUNTIME_STAGE_UNSPECIFIED": + case 0: + message.stage = 0; + break; + case "DEVELOPMENT": + case 1: + message.stage = 1; + break; + case "ALPHA": + case 2: + message.stage = 2; + break; + case "BETA": + case 3: + message.stage = 3; + break; + case "GA": + case 4: + message.stage = 4; + break; + case "DEPRECATED": + case 5: + message.stage = 5; + break; + case "DECOMMISSIONED": + case 6: + message.stage = 6; + break; + } + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) + message.warnings[i] = String(object.warnings[i]); + } + switch (object.environment) { + case "ENVIRONMENT_UNSPECIFIED": + case 0: + message.environment = 0; + break; + case "GEN_1": + case 1: + message.environment = 1; + break; + case "GEN_2": + case 2: + message.environment = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a Runtime message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2beta.ListRuntimesResponse.Runtime} message Runtime + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Runtime.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.warnings = []; + if (options.defaults) { + object.name = ""; + object.stage = options.enums === String ? "RUNTIME_STAGE_UNSPECIFIED" : 0; + object.environment = options.enums === String ? "ENVIRONMENT_UNSPECIFIED" : 0; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.stage != null && message.hasOwnProperty("stage")) + object.stage = options.enums === String ? $root.google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = message.warnings[j]; + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = options.enums === String ? $root.google.cloud.functions.v2beta.Environment[message.environment] : message.environment; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + return object; + }; + + /** + * Converts this Runtime to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @instance + * @returns {Object.} JSON object + */ + Runtime.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Runtime; + })(); + + /** + * RuntimeStage enum. + * @name google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage + * @enum {number} + * @property {number} RUNTIME_STAGE_UNSPECIFIED=0 RUNTIME_STAGE_UNSPECIFIED value + * @property {number} DEVELOPMENT=1 DEVELOPMENT value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + * @property {number} DECOMMISSIONED=6 DECOMMISSIONED value + */ + ListRuntimesResponse.RuntimeStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RUNTIME_STAGE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DEVELOPMENT"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + values[valuesById[6] = "DECOMMISSIONED"] = 6; + return values; + })(); + + return ListRuntimesResponse; + })(); + + v2beta.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.functions.v2beta + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [statusDetail] OperationMetadata statusDetail + * @property {boolean|null} [cancelRequested] OperationMetadata cancelRequested + * @property {string|null} [apiVersion] OperationMetadata apiVersion + * @property {google.protobuf.IAny|null} [requestResource] OperationMetadata requestResource + * @property {Array.|null} [stages] OperationMetadata stages + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.functions.v2beta.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(properties) { + this.stages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata statusDetail. + * @member {string} statusDetail + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.statusDetail = ""; + + /** + * OperationMetadata cancelRequested. + * @member {boolean} cancelRequested + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.cancelRequested = false; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * OperationMetadata requestResource. + * @member {google.protobuf.IAny|null|undefined} requestResource + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.requestResource = null; + + /** + * OperationMetadata stages. + * @member {Array.} stages + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.stages = $util.emptyArray; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {google.cloud.functions.v2beta.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.functions.v2beta.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {google.cloud.functions.v2beta.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.statusDetail != null && Object.hasOwnProperty.call(message, "statusDetail")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusDetail); + if (message.cancelRequested != null && Object.hasOwnProperty.call(message, "cancelRequested")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.cancelRequested); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); + if (message.requestResource != null && Object.hasOwnProperty.call(message, "requestResource")) + $root.google.protobuf.Any.encode(message.requestResource, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.stages != null && message.stages.length) + for (var i = 0; i < message.stages.length; ++i) + $root.google.cloud.functions.v2beta.Stage.encode(message.stages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {google.cloud.functions.v2beta.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.target = reader.string(); + break; + case 4: + message.verb = reader.string(); + break; + case 5: + message.statusDetail = reader.string(); + break; + case 6: + message.cancelRequested = reader.bool(); + break; + case 7: + message.apiVersion = reader.string(); + break; + case 8: + message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.stages && message.stages.length)) + message.stages = []; + message.stages.push($root.google.cloud.functions.v2beta.Stage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + if (!$util.isString(message.statusDetail)) + return "statusDetail: string expected"; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + if (typeof message.cancelRequested !== "boolean") + return "cancelRequested: boolean expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; + if (message.requestResource != null && message.hasOwnProperty("requestResource")) { + var error = $root.google.protobuf.Any.verify(message.requestResource); + if (error) + return "requestResource." + error; + } + if (message.stages != null && message.hasOwnProperty("stages")) { + if (!Array.isArray(message.stages)) + return "stages: array expected"; + for (var i = 0; i < message.stages.length; ++i) { + var error = $root.google.cloud.functions.v2beta.Stage.verify(message.stages[i]); + if (error) + return "stages." + error; + } + } + return null; + }; + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.OperationMetadata) + return object; + var message = new $root.google.cloud.functions.v2beta.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.functions.v2beta.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.functions.v2beta.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.statusDetail != null) + message.statusDetail = String(object.statusDetail); + if (object.cancelRequested != null) + message.cancelRequested = Boolean(object.cancelRequested); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); + if (object.requestResource != null) { + if (typeof object.requestResource !== "object") + throw TypeError(".google.cloud.functions.v2beta.OperationMetadata.requestResource: object expected"); + message.requestResource = $root.google.protobuf.Any.fromObject(object.requestResource); + } + if (object.stages) { + if (!Array.isArray(object.stages)) + throw TypeError(".google.cloud.functions.v2beta.OperationMetadata.stages: array expected"); + message.stages = []; + for (var i = 0; i < object.stages.length; ++i) { + if (typeof object.stages[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.OperationMetadata.stages: object expected"); + message.stages[i] = $root.google.cloud.functions.v2beta.Stage.fromObject(object.stages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {google.cloud.functions.v2beta.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stages = []; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.statusDetail = ""; + object.cancelRequested = false; + object.apiVersion = ""; + object.requestResource = null; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + object.statusDetail = message.statusDetail; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + object.cancelRequested = message.cancelRequested; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; + if (message.requestResource != null && message.hasOwnProperty("requestResource")) + object.requestResource = $root.google.protobuf.Any.toObject(message.requestResource, options); + if (message.stages && message.stages.length) { + object.stages = []; + for (var j = 0; j < message.stages.length; ++j) + object.stages[j] = $root.google.cloud.functions.v2beta.Stage.toObject(message.stages[j], options); + } + return object; + }; + + /** + * Converts this OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationMetadata; + })(); + + v2beta.Stage = (function() { + + /** + * Properties of a Stage. + * @memberof google.cloud.functions.v2beta + * @interface IStage + * @property {google.cloud.functions.v2beta.Stage.Name|null} [name] Stage name + * @property {string|null} [message] Stage message + * @property {google.cloud.functions.v2beta.Stage.State|null} [state] Stage state + * @property {string|null} [resource] Stage resource + * @property {string|null} [resourceUri] Stage resourceUri + * @property {Array.|null} [stateMessages] Stage stateMessages + */ + + /** + * Constructs a new Stage. + * @memberof google.cloud.functions.v2beta + * @classdesc Represents a Stage. + * @implements IStage + * @constructor + * @param {google.cloud.functions.v2beta.IStage=} [properties] Properties to set + */ + function Stage(properties) { + this.stateMessages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Stage name. + * @member {google.cloud.functions.v2beta.Stage.Name} name + * @memberof google.cloud.functions.v2beta.Stage + * @instance + */ + Stage.prototype.name = 0; + + /** + * Stage message. + * @member {string} message + * @memberof google.cloud.functions.v2beta.Stage + * @instance + */ + Stage.prototype.message = ""; + + /** + * Stage state. + * @member {google.cloud.functions.v2beta.Stage.State} state + * @memberof google.cloud.functions.v2beta.Stage + * @instance + */ + Stage.prototype.state = 0; + + /** + * Stage resource. + * @member {string} resource + * @memberof google.cloud.functions.v2beta.Stage + * @instance + */ + Stage.prototype.resource = ""; + + /** + * Stage resourceUri. + * @member {string} resourceUri + * @memberof google.cloud.functions.v2beta.Stage + * @instance + */ + Stage.prototype.resourceUri = ""; + + /** + * Stage stateMessages. + * @member {Array.} stateMessages + * @memberof google.cloud.functions.v2beta.Stage + * @instance + */ + Stage.prototype.stateMessages = $util.emptyArray; + + /** + * Creates a new Stage instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {google.cloud.functions.v2beta.IStage=} [properties] Properties to set + * @returns {google.cloud.functions.v2beta.Stage} Stage instance + */ + Stage.create = function create(properties) { + return new Stage(properties); + }; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.cloud.functions.v2beta.Stage.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {google.cloud.functions.v2beta.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.name); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.resource); + if (message.resourceUri != null && Object.hasOwnProperty.call(message, "resourceUri")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.resourceUri); + if (message.stateMessages != null && message.stateMessages.length) + for (var i = 0; i < message.stateMessages.length; ++i) + $root.google.cloud.functions.v2beta.StateMessage.encode(message.stateMessages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.cloud.functions.v2beta.Stage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {google.cloud.functions.v2beta.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2beta.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2beta.Stage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.int32(); + break; + case 2: + message.message = reader.string(); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.resource = reader.string(); + break; + case 5: + message.resourceUri = reader.string(); + break; + case 6: + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2beta.StateMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2beta.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Stage message. + * @function verify + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Stage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + switch (message.name) { + default: + return "name: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) + if (!$util.isString(message.resourceUri)) + return "resourceUri: string expected"; + if (message.stateMessages != null && message.hasOwnProperty("stateMessages")) { + if (!Array.isArray(message.stateMessages)) + return "stateMessages: array expected"; + for (var i = 0; i < message.stateMessages.length; ++i) { + var error = $root.google.cloud.functions.v2beta.StateMessage.verify(message.stateMessages[i]); + if (error) + return "stateMessages." + error; + } + } + return null; + }; + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2beta.Stage} Stage + */ + Stage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2beta.Stage) + return object; + var message = new $root.google.cloud.functions.v2beta.Stage(); + switch (object.name) { + case "NAME_UNSPECIFIED": + case 0: + message.name = 0; + break; + case "ARTIFACT_REGISTRY": + case 1: + message.name = 1; + break; + case "BUILD": + case 2: + message.name = 2; + break; + case "SERVICE": + case 3: + message.name = 3; + break; + case "TRIGGER": + case 4: + message.name = 4; + break; + case "SERVICE_ROLLBACK": + case 5: + message.name = 5; + break; + case "TRIGGER_ROLLBACK": + case 6: + message.name = 6; + break; + } + if (object.message != null) + message.message = String(object.message); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "NOT_STARTED": + case 1: + message.state = 1; + break; + case "IN_PROGRESS": + case 2: + message.state = 2; + break; + case "COMPLETE": + case 3: + message.state = 3; + break; + } + if (object.resource != null) + message.resource = String(object.resource); + if (object.resourceUri != null) + message.resourceUri = String(object.resourceUri); + if (object.stateMessages) { + if (!Array.isArray(object.stateMessages)) + throw TypeError(".google.cloud.functions.v2beta.Stage.stateMessages: array expected"); + message.stateMessages = []; + for (var i = 0; i < object.stateMessages.length; ++i) { + if (typeof object.stateMessages[i] !== "object") + throw TypeError(".google.cloud.functions.v2beta.Stage.stateMessages: object expected"); + message.stateMessages[i] = $root.google.cloud.functions.v2beta.StateMessage.fromObject(object.stateMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {google.cloud.functions.v2beta.Stage} message Stage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Stage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stateMessages = []; + if (options.defaults) { + object.name = options.enums === String ? "NAME_UNSPECIFIED" : 0; + object.message = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.resource = ""; + object.resourceUri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = options.enums === String ? $root.google.cloud.functions.v2beta.Stage.Name[message.name] : message.name; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.functions.v2beta.Stage.State[message.state] : message.state; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) + object.resourceUri = message.resourceUri; + if (message.stateMessages && message.stateMessages.length) { + object.stateMessages = []; + for (var j = 0; j < message.stateMessages.length; ++j) + object.stateMessages[j] = $root.google.cloud.functions.v2beta.StateMessage.toObject(message.stateMessages[j], options); + } + return object; + }; + + /** + * Converts this Stage to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2beta.Stage + * @instance + * @returns {Object.} JSON object + */ + Stage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Name enum. + * @name google.cloud.functions.v2beta.Stage.Name + * @enum {number} + * @property {number} NAME_UNSPECIFIED=0 NAME_UNSPECIFIED value + * @property {number} ARTIFACT_REGISTRY=1 ARTIFACT_REGISTRY value + * @property {number} BUILD=2 BUILD value + * @property {number} SERVICE=3 SERVICE value + * @property {number} TRIGGER=4 TRIGGER value + * @property {number} SERVICE_ROLLBACK=5 SERVICE_ROLLBACK value + * @property {number} TRIGGER_ROLLBACK=6 TRIGGER_ROLLBACK value + */ + Stage.Name = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NAME_UNSPECIFIED"] = 0; + values[valuesById[1] = "ARTIFACT_REGISTRY"] = 1; + values[valuesById[2] = "BUILD"] = 2; + values[valuesById[3] = "SERVICE"] = 3; + values[valuesById[4] = "TRIGGER"] = 4; + values[valuesById[5] = "SERVICE_ROLLBACK"] = 5; + values[valuesById[6] = "TRIGGER_ROLLBACK"] = 6; + return values; + })(); + + /** + * State enum. + * @name google.cloud.functions.v2beta.Stage.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} NOT_STARTED=1 NOT_STARTED value + * @property {number} IN_PROGRESS=2 IN_PROGRESS value + * @property {number} COMPLETE=3 COMPLETE value + */ + Stage.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOT_STARTED"] = 1; + values[valuesById[2] = "IN_PROGRESS"] = 2; + values[valuesById[3] = "COMPLETE"] = 3; + return values; + })(); + + return Stage; + })(); + + return v2beta; + })(); + return functions; })(); diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index 6cd02f265c8..deecc0c40b8 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -807,6 +807,1976 @@ } } } + }, + "v2alpha": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/functions/v2alpha;functions", + "java_multiple_files": true, + "java_outer_classname": "FunctionsProto", + "java_package": "com.google.cloud.functions.v2alpha", + "objc_class_prefix": "GCF", + "(google.api.resource_definition).type": "pubsub.googleapis.com/Topic", + "(google.api.resource_definition).pattern": "projects/{project}/topics/{topic}" + }, + "nested": { + "FunctionService": { + "options": { + "(google.api.default_host)": "cloudfunctions.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "GetFunction": { + "requestType": "GetFunctionRequest", + "responseType": "Function", + "options": { + "(google.api.http).get": "/v2alpha/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListFunctions": { + "requestType": "ListFunctionsRequest", + "responseType": "ListFunctionsResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*}/functions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*}/functions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "CreateFunction": { + "requestType": "CreateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*}/functions", + "(google.api.http).body": "function", + "(google.api.method_signature)": "parent,function,function_id", + "(google.longrunning.operation_info).response_type": "google.cloud.functions.v2alpha.Function", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2alpha.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*}/functions", + "body": "function" + } + }, + { + "(google.api.method_signature)": "parent,function,function_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.functions.v2alpha.Function", + "metadata_type": "google.cloud.functions.v2alpha.OperationMetadata" + } + } + ] + }, + "UpdateFunction": { + "requestType": "UpdateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v2alpha/{function.name=projects/*/locations/*/functions/*}", + "(google.api.http).body": "function", + "(google.api.method_signature)": "function,update_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.functions.v2alpha.Function", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2alpha.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2alpha/{function.name=projects/*/locations/*/functions/*}", + "body": "function" + } + }, + { + "(google.api.method_signature)": "function,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.functions.v2alpha.Function", + "metadata_type": "google.cloud.functions.v2alpha.OperationMetadata" + } + } + ] + }, + "DeleteFunction": { + "requestType": "DeleteFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2alpha/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2alpha.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2alpha/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.functions.v2alpha.OperationMetadata" + } + } + ] + }, + "GenerateUploadUrl": { + "requestType": "GenerateUploadUrlRequest", + "responseType": "GenerateUploadUrlResponse", + "options": { + "(google.api.http).post": "/v2alpha/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "body": "*" + } + } + ] + }, + "GenerateDownloadUrl": { + "requestType": "GenerateDownloadUrlRequest", + "responseType": "GenerateDownloadUrlResponse", + "options": { + "(google.api.http).post": "/v2alpha/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2alpha/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "body": "*" + } + } + ] + }, + "ListRuntimes": { + "requestType": "ListRuntimesRequest", + "responseType": "ListRuntimesResponse", + "options": { + "(google.api.http).get": "/v2alpha/{parent=projects/*/locations/*}/runtimes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2alpha/{parent=projects/*/locations/*}/runtimes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "Environment": { + "values": { + "ENVIRONMENT_UNSPECIFIED": 0, + "GEN_1": 1, + "GEN_2": 2 + } + }, + "Function": { + "options": { + "(google.api.resource).type": "cloudfunctions.googleapis.com/Function", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/functions/{function}", + "(google.api.resource).plural": "functions", + "(google.api.resource).singular": "function" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "environment": { + "type": "Environment", + "id": 10 + }, + "description": { + "type": "string", + "id": 2 + }, + "buildConfig": { + "type": "BuildConfig", + "id": 3 + }, + "serviceConfig": { + "type": "ServiceConfig", + "id": 4 + }, + "eventTrigger": { + "type": "EventTrigger", + "id": 5 + }, + "state": { + "type": "State", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + }, + "stateMessages": { + "rule": "repeated", + "type": "StateMessage", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "FAILED": 2, + "DEPLOYING": 3, + "DELETING": 4, + "UNKNOWN": 5 + } + } + } + }, + "StateMessage": { + "fields": { + "severity": { + "type": "Severity", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + } + }, + "nested": { + "Severity": { + "values": { + "SEVERITY_UNSPECIFIED": 0, + "ERROR": 1, + "WARNING": 2, + "INFO": 3 + } + } + } + }, + "StorageSource": { + "fields": { + "bucket": { + "type": "string", + "id": 1 + }, + "object": { + "type": "string", + "id": 2 + }, + "generation": { + "type": "int64", + "id": 3 + } + } + }, + "RepoSource": { + "oneofs": { + "revision": { + "oneof": [ + "branchName", + "tagName", + "commitSha" + ] + } + }, + "fields": { + "branchName": { + "type": "string", + "id": 3 + }, + "tagName": { + "type": "string", + "id": 4 + }, + "commitSha": { + "type": "string", + "id": 5 + }, + "projectId": { + "type": "string", + "id": 1 + }, + "repoName": { + "type": "string", + "id": 2 + }, + "dir": { + "type": "string", + "id": 6 + }, + "invertRegex": { + "type": "bool", + "id": 7 + } + } + }, + "Source": { + "oneofs": { + "source": { + "oneof": [ + "storageSource", + "repoSource" + ] + } + }, + "fields": { + "storageSource": { + "type": "StorageSource", + "id": 1 + }, + "repoSource": { + "type": "RepoSource", + "id": 2 + } + } + }, + "SourceProvenance": { + "fields": { + "resolvedStorageSource": { + "type": "StorageSource", + "id": 1 + }, + "resolvedRepoSource": { + "type": "RepoSource", + "id": 2 + } + } + }, + "BuildConfig": { + "fields": { + "build": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/Build" + } + }, + "runtime": { + "type": "string", + "id": 2 + }, + "entryPoint": { + "type": "string", + "id": 3 + }, + "source": { + "type": "Source", + "id": 4 + }, + "sourceProvenance": { + "type": "SourceProvenance", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "workerPool": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/WorkerPool" + } + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 6 + }, + "dockerRepository": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "artifactregistry.googleapis.com/Repository" + } + } + } + }, + "ServiceConfig": { + "fields": { + "service": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "run.googleapis.com/Service" + } + }, + "timeoutSeconds": { + "type": "int32", + "id": 2 + }, + "availableMemory": { + "type": "string", + "id": 13 + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 4 + }, + "maxInstanceCount": { + "type": "int32", + "id": 5 + }, + "minInstanceCount": { + "type": "int32", + "id": 12 + }, + "vpcConnector": { + "type": "string", + "id": 6, + "options": { + "(google.api.resource_reference).type": "vpcaccess.googleapis.com/Connector" + } + }, + "vpcConnectorEgressSettings": { + "type": "VpcConnectorEgressSettings", + "id": 7 + }, + "ingressSettings": { + "type": "IngressSettings", + "id": 8 + }, + "uri": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "serviceAccountEmail": { + "type": "string", + "id": 10 + }, + "allTrafficOnLatestRevision": { + "type": "bool", + "id": 16 + }, + "secretEnvironmentVariables": { + "rule": "repeated", + "type": "SecretEnvVar", + "id": 17 + }, + "secretVolumes": { + "rule": "repeated", + "type": "SecretVolume", + "id": 19 + }, + "revision": { + "type": "string", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "VpcConnectorEgressSettings": { + "values": { + "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": 0, + "PRIVATE_RANGES_ONLY": 1, + "ALL_TRAFFIC": 2 + } + }, + "IngressSettings": { + "values": { + "INGRESS_SETTINGS_UNSPECIFIED": 0, + "ALLOW_ALL": 1, + "ALLOW_INTERNAL_ONLY": 2, + "ALLOW_INTERNAL_AND_GCLB": 3 + } + } + } + }, + "SecretEnvVar": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "version": { + "type": "string", + "id": 4 + } + } + }, + "SecretVolume": { + "fields": { + "mountPath": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "versions": { + "rule": "repeated", + "type": "SecretVersion", + "id": 4 + } + }, + "nested": { + "SecretVersion": { + "fields": { + "version": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + } + } + }, + "EventTrigger": { + "fields": { + "trigger": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Trigger" + } + }, + "triggerRegion": { + "type": "string", + "id": 2 + }, + "eventType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "eventFilters": { + "rule": "repeated", + "type": "EventFilter", + "id": 4 + }, + "pubsubTopic": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "pubsub.googleapis.com/Topic" + } + }, + "serviceAccountEmail": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "retryPolicy": { + "type": "RetryPolicy", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "channel": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Channel" + } + } + }, + "nested": { + "RetryPolicy": { + "values": { + "RETRY_POLICY_UNSPECIFIED": 0, + "RETRY_POLICY_DO_NOT_RETRY": 1, + "RETRY_POLICY_RETRY": 2 + } + } + } + }, + "EventFilter": { + "fields": { + "attribute": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "value": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "operator": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GetFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "ListFunctionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudfunctions.googleapis.com/Function" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "orderBy": { + "type": "string", + "id": 5 + } + } + }, + "ListFunctionsResponse": { + "fields": { + "functions": { + "rule": "repeated", + "type": "Function", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "CreateFunctionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "function": { + "type": "Function", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "functionId": { + "type": "string", + "id": 3 + } + } + }, + "UpdateFunctionRequest": { + "fields": { + "function": { + "type": "Function", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "GenerateUploadUrlRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + } + } + }, + "GenerateUploadUrlResponse": { + "fields": { + "uploadUrl": { + "type": "string", + "id": 1 + }, + "storageSource": { + "type": "StorageSource", + "id": 2 + } + } + }, + "GenerateDownloadUrlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "GenerateDownloadUrlResponse": { + "fields": { + "downloadUrl": { + "type": "string", + "id": 1 + } + } + }, + "ListRuntimesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "filter": { + "type": "string", + "id": 2 + } + } + }, + "ListRuntimesResponse": { + "fields": { + "runtimes": { + "rule": "repeated", + "type": "Runtime", + "id": 1 + } + }, + "nested": { + "Runtime": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 5 + }, + "stage": { + "type": "RuntimeStage", + "id": 2 + }, + "warnings": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "environment": { + "type": "Environment", + "id": 4 + } + } + }, + "RuntimeStage": { + "values": { + "RUNTIME_STAGE_UNSPECIFIED": 0, + "DEVELOPMENT": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5, + "DECOMMISSIONED": 6 + } + } + } + }, + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "target": { + "type": "string", + "id": 3 + }, + "verb": { + "type": "string", + "id": 4 + }, + "statusDetail": { + "type": "string", + "id": 5 + }, + "cancelRequested": { + "type": "bool", + "id": 6 + }, + "apiVersion": { + "type": "string", + "id": 7 + }, + "requestResource": { + "type": "google.protobuf.Any", + "id": 8 + }, + "stages": { + "rule": "repeated", + "type": "Stage", + "id": 9 + } + } + }, + "Stage": { + "fields": { + "name": { + "type": "Name", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "state": { + "type": "State", + "id": 3 + }, + "resource": { + "type": "string", + "id": 4 + }, + "resourceUri": { + "type": "string", + "id": 5 + }, + "stateMessages": { + "rule": "repeated", + "type": "StateMessage", + "id": 6 + } + }, + "nested": { + "Name": { + "values": { + "NAME_UNSPECIFIED": 0, + "ARTIFACT_REGISTRY": 1, + "BUILD": 2, + "SERVICE": 3, + "TRIGGER": 4, + "SERVICE_ROLLBACK": 5, + "TRIGGER_ROLLBACK": 6 + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "NOT_STARTED": 1, + "IN_PROGRESS": 2, + "COMPLETE": 3 + } + } + } + } + } + }, + "v2beta": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/functions/v2beta;functions", + "java_multiple_files": true, + "java_outer_classname": "FunctionsProto", + "java_package": "com.google.cloud.functions.v2beta", + "objc_class_prefix": "GCF", + "(google.api.resource_definition).type": "pubsub.googleapis.com/Topic", + "(google.api.resource_definition).pattern": "projects/{project}/topics/{topic}" + }, + "nested": { + "FunctionService": { + "options": { + "(google.api.default_host)": "cloudfunctions.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "GetFunction": { + "requestType": "GetFunctionRequest", + "responseType": "Function", + "options": { + "(google.api.http).get": "/v2beta/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListFunctions": { + "requestType": "ListFunctionsRequest", + "responseType": "ListFunctionsResponse", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*}/functions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*}/functions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "CreateFunction": { + "requestType": "CreateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*}/functions", + "(google.api.http).body": "function", + "(google.api.method_signature)": "parent,function,function_id", + "(google.longrunning.operation_info).response_type": "google.cloud.functions.v2beta.Function", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2beta.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*}/functions", + "body": "function" + } + }, + { + "(google.api.method_signature)": "parent,function,function_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.functions.v2beta.Function", + "metadata_type": "google.cloud.functions.v2beta.OperationMetadata" + } + } + ] + }, + "UpdateFunction": { + "requestType": "UpdateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v2beta/{function.name=projects/*/locations/*/functions/*}", + "(google.api.http).body": "function", + "(google.api.method_signature)": "function,update_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.functions.v2beta.Function", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2beta.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta/{function.name=projects/*/locations/*/functions/*}", + "body": "function" + } + }, + { + "(google.api.method_signature)": "function,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.functions.v2beta.Function", + "metadata_type": "google.cloud.functions.v2beta.OperationMetadata" + } + } + ] + }, + "DeleteFunction": { + "requestType": "DeleteFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2beta/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2beta.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.functions.v2beta.OperationMetadata" + } + } + ] + }, + "GenerateUploadUrl": { + "requestType": "GenerateUploadUrlRequest", + "responseType": "GenerateUploadUrlResponse", + "options": { + "(google.api.http).post": "/v2beta/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "body": "*" + } + } + ] + }, + "GenerateDownloadUrl": { + "requestType": "GenerateDownloadUrlRequest", + "responseType": "GenerateDownloadUrlResponse", + "options": { + "(google.api.http).post": "/v2beta/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "body": "*" + } + } + ] + }, + "ListRuntimes": { + "requestType": "ListRuntimesRequest", + "responseType": "ListRuntimesResponse", + "options": { + "(google.api.http).get": "/v2beta/{parent=projects/*/locations/*}/runtimes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta/{parent=projects/*/locations/*}/runtimes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "Environment": { + "values": { + "ENVIRONMENT_UNSPECIFIED": 0, + "GEN_1": 1, + "GEN_2": 2 + } + }, + "Function": { + "options": { + "(google.api.resource).type": "cloudfunctions.googleapis.com/Function", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/functions/{function}", + "(google.api.resource).plural": "functions", + "(google.api.resource).singular": "function" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "environment": { + "type": "Environment", + "id": 10 + }, + "description": { + "type": "string", + "id": 2 + }, + "buildConfig": { + "type": "BuildConfig", + "id": 3 + }, + "serviceConfig": { + "type": "ServiceConfig", + "id": 4 + }, + "eventTrigger": { + "type": "EventTrigger", + "id": 5 + }, + "state": { + "type": "State", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + }, + "stateMessages": { + "rule": "repeated", + "type": "StateMessage", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "FAILED": 2, + "DEPLOYING": 3, + "DELETING": 4, + "UNKNOWN": 5 + } + } + } + }, + "StateMessage": { + "fields": { + "severity": { + "type": "Severity", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + } + }, + "nested": { + "Severity": { + "values": { + "SEVERITY_UNSPECIFIED": 0, + "ERROR": 1, + "WARNING": 2, + "INFO": 3 + } + } + } + }, + "StorageSource": { + "fields": { + "bucket": { + "type": "string", + "id": 1 + }, + "object": { + "type": "string", + "id": 2 + }, + "generation": { + "type": "int64", + "id": 3 + } + } + }, + "RepoSource": { + "oneofs": { + "revision": { + "oneof": [ + "branchName", + "tagName", + "commitSha" + ] + } + }, + "fields": { + "branchName": { + "type": "string", + "id": 3 + }, + "tagName": { + "type": "string", + "id": 4 + }, + "commitSha": { + "type": "string", + "id": 5 + }, + "projectId": { + "type": "string", + "id": 1 + }, + "repoName": { + "type": "string", + "id": 2 + }, + "dir": { + "type": "string", + "id": 6 + }, + "invertRegex": { + "type": "bool", + "id": 7 + } + } + }, + "Source": { + "oneofs": { + "source": { + "oneof": [ + "storageSource", + "repoSource" + ] + } + }, + "fields": { + "storageSource": { + "type": "StorageSource", + "id": 1 + }, + "repoSource": { + "type": "RepoSource", + "id": 2 + } + } + }, + "SourceProvenance": { + "fields": { + "resolvedStorageSource": { + "type": "StorageSource", + "id": 1 + }, + "resolvedRepoSource": { + "type": "RepoSource", + "id": 2 + } + } + }, + "BuildConfig": { + "fields": { + "build": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/Build" + } + }, + "runtime": { + "type": "string", + "id": 2 + }, + "entryPoint": { + "type": "string", + "id": 3 + }, + "source": { + "type": "Source", + "id": 4 + }, + "sourceProvenance": { + "type": "SourceProvenance", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "workerPool": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/WorkerPool" + } + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 6 + }, + "dockerRepository": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "artifactregistry.googleapis.com/Repository" + } + } + } + }, + "ServiceConfig": { + "fields": { + "service": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "run.googleapis.com/Service" + } + }, + "timeoutSeconds": { + "type": "int32", + "id": 2 + }, + "availableMemory": { + "type": "string", + "id": 13 + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 4 + }, + "maxInstanceCount": { + "type": "int32", + "id": 5 + }, + "minInstanceCount": { + "type": "int32", + "id": 12 + }, + "vpcConnector": { + "type": "string", + "id": 6, + "options": { + "(google.api.resource_reference).type": "vpcaccess.googleapis.com/Connector" + } + }, + "vpcConnectorEgressSettings": { + "type": "VpcConnectorEgressSettings", + "id": 7 + }, + "ingressSettings": { + "type": "IngressSettings", + "id": 8 + }, + "uri": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "serviceAccountEmail": { + "type": "string", + "id": 10 + }, + "allTrafficOnLatestRevision": { + "type": "bool", + "id": 16 + }, + "secretEnvironmentVariables": { + "rule": "repeated", + "type": "SecretEnvVar", + "id": 17 + }, + "secretVolumes": { + "rule": "repeated", + "type": "SecretVolume", + "id": 19 + }, + "revision": { + "type": "string", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "VpcConnectorEgressSettings": { + "values": { + "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": 0, + "PRIVATE_RANGES_ONLY": 1, + "ALL_TRAFFIC": 2 + } + }, + "IngressSettings": { + "values": { + "INGRESS_SETTINGS_UNSPECIFIED": 0, + "ALLOW_ALL": 1, + "ALLOW_INTERNAL_ONLY": 2, + "ALLOW_INTERNAL_AND_GCLB": 3 + } + } + } + }, + "SecretEnvVar": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "version": { + "type": "string", + "id": 4 + } + } + }, + "SecretVolume": { + "fields": { + "mountPath": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "versions": { + "rule": "repeated", + "type": "SecretVersion", + "id": 4 + } + }, + "nested": { + "SecretVersion": { + "fields": { + "version": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + } + } + }, + "EventTrigger": { + "fields": { + "trigger": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Trigger" + } + }, + "triggerRegion": { + "type": "string", + "id": 2 + }, + "eventType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "eventFilters": { + "rule": "repeated", + "type": "EventFilter", + "id": 4 + }, + "pubsubTopic": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "pubsub.googleapis.com/Topic" + } + }, + "serviceAccountEmail": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "retryPolicy": { + "type": "RetryPolicy", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "channel": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Channel" + } + } + }, + "nested": { + "RetryPolicy": { + "values": { + "RETRY_POLICY_UNSPECIFIED": 0, + "RETRY_POLICY_DO_NOT_RETRY": 1, + "RETRY_POLICY_RETRY": 2 + } + } + } + }, + "EventFilter": { + "fields": { + "attribute": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "value": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "operator": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GetFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "ListFunctionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudfunctions.googleapis.com/Function" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "orderBy": { + "type": "string", + "id": 5 + } + } + }, + "ListFunctionsResponse": { + "fields": { + "functions": { + "rule": "repeated", + "type": "Function", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "CreateFunctionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "function": { + "type": "Function", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "functionId": { + "type": "string", + "id": 3 + } + } + }, + "UpdateFunctionRequest": { + "fields": { + "function": { + "type": "Function", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "GenerateUploadUrlRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + } + } + }, + "GenerateUploadUrlResponse": { + "fields": { + "uploadUrl": { + "type": "string", + "id": 1 + }, + "storageSource": { + "type": "StorageSource", + "id": 2 + } + } + }, + "GenerateDownloadUrlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "GenerateDownloadUrlResponse": { + "fields": { + "downloadUrl": { + "type": "string", + "id": 1 + } + } + }, + "ListRuntimesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "filter": { + "type": "string", + "id": 2 + } + } + }, + "ListRuntimesResponse": { + "fields": { + "runtimes": { + "rule": "repeated", + "type": "Runtime", + "id": 1 + } + }, + "nested": { + "Runtime": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 5 + }, + "stage": { + "type": "RuntimeStage", + "id": 2 + }, + "warnings": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "environment": { + "type": "Environment", + "id": 4 + } + } + }, + "RuntimeStage": { + "values": { + "RUNTIME_STAGE_UNSPECIFIED": 0, + "DEVELOPMENT": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5, + "DECOMMISSIONED": 6 + } + } + } + }, + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "target": { + "type": "string", + "id": 3 + }, + "verb": { + "type": "string", + "id": 4 + }, + "statusDetail": { + "type": "string", + "id": 5 + }, + "cancelRequested": { + "type": "bool", + "id": 6 + }, + "apiVersion": { + "type": "string", + "id": 7 + }, + "requestResource": { + "type": "google.protobuf.Any", + "id": 8 + }, + "stages": { + "rule": "repeated", + "type": "Stage", + "id": 9 + } + } + }, + "Stage": { + "fields": { + "name": { + "type": "Name", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "state": { + "type": "State", + "id": 3 + }, + "resource": { + "type": "string", + "id": 4 + }, + "resourceUri": { + "type": "string", + "id": 5 + }, + "stateMessages": { + "rule": "repeated", + "type": "StateMessage", + "id": 6 + } + }, + "nested": { + "Name": { + "values": { + "NAME_UNSPECIFIED": 0, + "ARTIFACT_REGISTRY": 1, + "BUILD": 2, + "SERVICE": 3, + "TRIGGER": 4, + "SERVICE_ROLLBACK": 5, + "TRIGGER_ROLLBACK": 6 + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "NOT_STARTED": 1, + "IN_PROGRESS": 2, + "COMPLETE": 3 + } + } + } + } + } } } } diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js new file mode 100644 index 00000000000..d59bad0f78a --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js @@ -0,0 +1,72 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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, function1) { + // [START cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + */ + // const functionId = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + parent, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js new file mode 100644 index 00000000000..87f9f61b701 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js new file mode 100644 index 00000000000..1ffdf4e3264 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of function for which source code Google Cloud Storage signed + * URL should be generated. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js new file mode 100644 index 00000000000..70c5d31f667 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js new file mode 100644 index 00000000000..56d716bfcec --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js @@ -0,0 +1,58 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js new file mode 100644 index 00000000000..cd3dabf2e03 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js @@ -0,0 +1,87 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListFunctions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js new file mode 100644 index 00000000000..d642b220801 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js @@ -0,0 +1,64 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location from which the runtimes should be listed, + * specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListRuntimes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.listRuntimes(request); + console.log(response); + } + + callListRuntimes(); + // [END cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js new file mode 100644 index 00000000000..856dfad7576 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js @@ -0,0 +1,65 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(function1) { + // [START cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. New version of the function. + */ + // const function = {} + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + */ + // const updateMask = {} + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2alpha; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json new file mode 100644 index 00000000000..540c4f9d123 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json @@ -0,0 +1,367 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "2.0.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v2alpha", + "version": "v2alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async", + "title": "FunctionService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "function_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.Function", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GetFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async", + "title": "FunctionService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "function_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2alpha.FunctionService.ListFunctions", + "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.functions.v2alpha.ListFunctionsResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2alpha.FunctionService.ListFunctions", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async", + "title": "FunctionService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "function_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v2alpha.Function" + }, + { + "name": "function_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.CreateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async", + "title": "FunctionService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "function_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v2alpha.Function" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.UpdateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async", + "title": "FunctionService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "function_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2alpha.FunctionService.DeleteFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async", + "title": "FunctionService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "function_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.GenerateUploadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateUploadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async", + "title": "FunctionService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "function_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.GenerateDownloadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2alpha.FunctionService.GenerateDownloadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async", + "title": "FunctionService listRuntimes Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of runtimes that are supported for the requested project.", + "canonical": true, + "file": "function_service.list_runtimes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2alpha.FunctionService.ListRuntimes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2alpha.ListRuntimesResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2alpha.FunctionServiceClient" + }, + "method": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2alpha.FunctionService.ListRuntimes", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2alpha.FunctionService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js new file mode 100644 index 00000000000..da1ae2daeba --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js @@ -0,0 +1,72 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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, function1) { + // [START cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + */ + // const functionId = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + parent, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js new file mode 100644 index 00000000000..938c8dd0e26 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js new file mode 100644 index 00000000000..bb8cd0f027e --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of function for which source code Google Cloud Storage signed + * URL should be generated. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js new file mode 100644 index 00000000000..f1bd6c681a4 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js new file mode 100644 index 00000000000..50fa52ae121 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js @@ -0,0 +1,58 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2beta_generated_FunctionService_GetFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v2beta_generated_FunctionService_GetFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js new file mode 100644 index 00000000000..003333da810 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js @@ -0,0 +1,87 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListFunctions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js new file mode 100644 index 00000000000..a531d249864 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js @@ -0,0 +1,64 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location from which the runtimes should be listed, + * specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListRuntimes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.listRuntimes(request); + console.log(response); + } + + callListRuntimes(); + // [END cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js new file mode 100644 index 00000000000..e310003864e --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js @@ -0,0 +1,65 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(function1) { + // [START cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. New version of the function. + */ + // const function = {} + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + */ + // const updateMask = {} + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2beta; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json new file mode 100644 index 00000000000..5d04eaf0895 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json @@ -0,0 +1,367 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "2.0.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v2beta", + "version": "v2beta" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GetFunction_async", + "title": "FunctionService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "function_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.Function", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.GetFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async", + "title": "FunctionService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "function_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2beta.FunctionService.ListFunctions", + "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.functions.v2beta.ListFunctionsResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2beta.FunctionService.ListFunctions", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async", + "title": "FunctionService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "function_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v2beta.Function" + }, + { + "name": "function_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.CreateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async", + "title": "FunctionService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "function_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v2beta.Function" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.UpdateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async", + "title": "FunctionService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "function_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2beta.FunctionService.DeleteFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async", + "title": "FunctionService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "function_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.GenerateUploadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateUploadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async", + "title": "FunctionService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "function_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.GenerateDownloadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2beta.FunctionService.GenerateDownloadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async", + "title": "FunctionService listRuntimes Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of runtimes that are supported for the requested project.", + "canonical": true, + "file": "function_service.list_runtimes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2beta.FunctionService.ListRuntimes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2beta.ListRuntimesResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2beta.FunctionServiceClient" + }, + "method": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2beta.FunctionService.ListRuntimes", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2beta.FunctionService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-functions/src/index.ts b/packages/google-cloud-functions/src/index.ts index 395643b198b..9a05b7715c9 100644 --- a/packages/google-cloud-functions/src/index.ts +++ b/packages/google-cloud-functions/src/index.ts @@ -17,11 +17,13 @@ // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; +import * as v2alpha from './v2alpha'; +import * as v2beta from './v2beta'; const CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; type CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; -export {v1, CloudFunctionsServiceClient}; -export default {v1, CloudFunctionsServiceClient}; +export {v1, v2alpha, v2beta, CloudFunctionsServiceClient}; +export default {v1, v2alpha, v2beta, CloudFunctionsServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts new file mode 100644 index 00000000000..62943052035 --- /dev/null +++ b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts @@ -0,0 +1,2407 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2alpha/function_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './function_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Functions is used to deploy functions that are executed by + * Google in response to various events. Data connected with that event is + * passed to a function as the input data. + * + * A **function** is a resource which describes a function that should be + * executed and how it is triggered. + * @class + * @memberof v2alpha + */ +export class FunctionServiceClient { + 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}; + 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; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + functionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FunctionServiceClient. + * + * @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/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FunctionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.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 !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : 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 = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new IamClient(this._gaxGrpc, opts); + + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else 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); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + buildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + connectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectors/{connector}' + ), + functionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + triggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + workerPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workerPools/{worker_pool}' + ), + }; + + // 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 = { + listFunctions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'functions' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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. + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.Function' + ) as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.OperationMetadata' + ) as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.Function' + ) as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.OperationMetadata' + ) as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2alpha.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata) + ), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata) + ), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v2alpha.FunctionService', + 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 = gax.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.functionServiceStub) { + return this.functionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v2alpha.FunctionService. + this.functionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.functions.v2alpha.FunctionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v2alpha.FunctionService, + 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 functionServiceStubMethods = [ + 'getFunction', + 'listFunctions', + 'createFunction', + 'updateFunction', + 'deleteFunction', + 'generateUploadUrl', + 'generateDownloadUrl', + 'listRuntimes', + ]; + for (const methodName of functionServiceStubMethods) { + const callPromise = this.functionServiceStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.functionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + 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 function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Function]{@link google.cloud.functions.v2alpha.Function}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.get_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async + */ + getFunction( + request?: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IGetFunctionRequest | undefined, + {} | undefined + ] + >; + getFunction( + request: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2alpha.IFunction, + | protos.google.cloud.functions.v2alpha.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFunction( + request: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v2alpha.IFunction, + | protos.google.cloud.functions.v2alpha.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFunction( + request?: protos.google.cloud.functions.v2alpha.IGetFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2alpha.IFunction, + | protos.google.cloud.functions.v2alpha.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2alpha.IFunction, + | protos.google.cloud.functions.v2alpha.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IGetFunctionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFunction(request, options, callback); + } + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v2alpha.GenerateUploadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.generate_upload_url.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async + */ + generateUploadUrl( + request?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + ( + | protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest + | undefined + ), + {} | undefined + ] + >; + generateUploadUrl( + request: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse, + ( + | protos.google.cloud.functions.v2alpha.IGenerateUploadUrlRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.generateUploadUrl(request, options, callback); + } + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v2alpha.GenerateDownloadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.generate_download_url.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async + */ + generateDownloadUrl( + request?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + ( + | protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest + | undefined + ), + {} | undefined + ] + >; + generateDownloadUrl( + request: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateDownloadUrl( + request?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse, + ( + | protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.generateDownloadUrl(request, options, callback); + } + /** + * Returns a list of runtimes that are supported for the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the runtimes should be listed, + * specified in the format `projects/* /locations/*` + * @param {string} request.filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListRuntimesResponse]{@link google.cloud.functions.v2alpha.ListRuntimesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.list_runtimes.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async + */ + listRuntimes( + request?: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + protos.google.cloud.functions.v2alpha.IListRuntimesRequest | undefined, + {} | undefined + ] + >; + listRuntimes( + request: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + | protos.google.cloud.functions.v2alpha.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + listRuntimes( + request: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, + callback: Callback< + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + | protos.google.cloud.functions.v2alpha.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + listRuntimes( + request?: protos.google.cloud.functions.v2alpha.IListRuntimesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + | protos.google.cloud.functions.v2alpha.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + | protos.google.cloud.functions.v2alpha.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IListRuntimesResponse, + protos.google.cloud.functions.v2alpha.IListRuntimesRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listRuntimes(request, options, callback); + } + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + * @param {google.cloud.functions.v2alpha.Function} request.function + * Required. Function to be created. + * @param {string} request.functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.create_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async + */ + createFunction( + request?: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createFunction( + request: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createFunction( + request: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createFunction( + request?: protos.google.cloud.functions.v2alpha.ICreateFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.create_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async + */ + async checkCreateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v2alpha.Function, + protos.google.cloud.functions.v2alpha.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v2alpha.Function, + protos.google.cloud.functions.v2alpha.OperationMetadata + >; + } + /** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v2alpha.Function} request.function + * Required. New version of the function. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.update_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async + */ + updateFunction( + request?: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateFunction( + request: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateFunction( + request: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateFunction( + request?: protos.google.cloud.functions.v2alpha.IUpdateFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + 'function.name': request.function!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.update_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async + */ + async checkUpdateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v2alpha.Function, + protos.google.cloud.functions.v2alpha.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v2alpha.Function, + protos.google.cloud.functions.v2alpha.OperationMetadata + >; + } + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.delete_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async + */ + deleteFunction( + request?: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteFunction( + request: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteFunction( + request: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteFunction( + request?: protos.google.cloud.functions.v2alpha.IDeleteFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.delete_function.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async + */ + async checkDeleteFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v2alpha.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v2alpha.OperationMetadata + >; + } + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Function]{@link google.cloud.functions.v2alpha.Function}. + * 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFunctions( + request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IFunction[], + protos.google.cloud.functions.v2alpha.IListFunctionsRequest | null, + protos.google.cloud.functions.v2alpha.IListFunctionsResponse + ] + >; + listFunctions( + request: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + | protos.google.cloud.functions.v2alpha.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2alpha.IFunction + > + ): void; + listFunctions( + request: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + | protos.google.cloud.functions.v2alpha.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2alpha.IFunction + > + ): void; + listFunctions( + request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + | protos.google.cloud.functions.v2alpha.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2alpha.IFunction + >, + callback?: PaginationCallback< + protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + | protos.google.cloud.functions.v2alpha.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2alpha.IFunction + > + ): Promise< + [ + protos.google.cloud.functions.v2alpha.IFunction[], + protos.google.cloud.functions.v2alpha.IListFunctionsRequest | null, + protos.google.cloud.functions.v2alpha.IListFunctionsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFunctions(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 [Function]{@link google.cloud.functions.v2alpha.Function} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listFunctions`, 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 and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Function]{@link google.cloud.functions.v2alpha.Function}. 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2alpha/function_service.list_functions.js + * region_tag:cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v2alpha.IListFunctionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as unknown as RequestType, + 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 [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: 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 { + 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 + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + 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 { + 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 + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: 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 { + 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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * 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); + } + + /** + * Lists information about the supported locations for this service. 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 [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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, + options?: + | 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]> { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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, + options?: + | 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 { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified build resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + buildPath(project: string, location: string, build: string) { + return this.pathTemplates.buildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).project; + } + + /** + * Parse the location from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).location; + } + + /** + * Parse the build from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).build; + } + + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project: string, location: string, channel: string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified connector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connector + * @returns {string} Resource name string. + */ + connectorPath(project: string, location: string, connector: string) { + return this.pathTemplates.connectorPathTemplate.render({ + project: project, + location: location, + connector: connector, + }); + } + + /** + * Parse the project from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .project; + } + + /** + * Parse the location from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .location; + } + + /** + * Parse the connector from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the connector. + */ + matchConnectorFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .connector; + } + + /** + * Return a fully-qualified function resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + functionPath(project: string, location: string, functionParam: string) { + return this.pathTemplates.functionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * Parse the project from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).project; + } + + /** + * Parse the location from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).location; + } + + /** + * Parse the function from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).function; + } + + /** + * 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 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 repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project: string, location: string, repository: string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .repository; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project: string, location: string, service: string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project: string, topic: string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * Return a fully-qualified trigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + triggerPath(project: string, location: string, trigger: string) { + return this.pathTemplates.triggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).project; + } + + /** + * Parse the location from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).location; + } + + /** + * Parse the trigger from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; + } + + /** + * Return a fully-qualified workerPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} worker_pool + * @returns {string} Resource name string. + */ + workerPoolPath(project: string, location: string, workerPool: string) { + return this.pathTemplates.workerPoolPathTemplate.render({ + project: project, + location: location, + worker_pool: workerPool, + }); + } + + /** + * Parse the project from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .project; + } + + /** + * Parse the location from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .location; + } + + /** + * Parse the worker_pool from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the worker_pool. + */ + matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .worker_pool; + } + + /** + * 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.functionServiceStub && !this._terminated) { + return this.functionServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-functions/src/v2alpha/function_service_client_config.json b/packages/google-cloud-functions/src/v2alpha/function_service_client_config.json new file mode 100644 index 00000000000..2ca6513ccba --- /dev/null +++ b/packages/google-cloud-functions/src/v2alpha/function_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.functions.v2alpha.FunctionService": { + "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": { + "GetFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFunctions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v2alpha/function_service_proto_list.json b/packages/google-cloud-functions/src/v2alpha/function_service_proto_list.json new file mode 100644 index 00000000000..78acb336bb6 --- /dev/null +++ b/packages/google-cloud-functions/src/v2alpha/function_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/functions/v2alpha/functions.proto" +] diff --git a/packages/google-cloud-functions/src/v2alpha/gapic_metadata.json b/packages/google-cloud-functions/src/v2alpha/gapic_metadata.json new file mode 100644 index 00000000000..eaf1f6d3475 --- /dev/null +++ b/packages/google-cloud-functions/src/v2alpha/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v2alpha", + "libraryPackage": "@google-cloud/functions", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v2alpha/index.ts b/packages/google-cloud-functions/src/v2alpha/index.ts new file mode 100644 index 00000000000..a9477c6cf34 --- /dev/null +++ b/packages/google-cloud-functions/src/v2alpha/index.ts @@ -0,0 +1,19 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {FunctionServiceClient} from './function_service_client'; diff --git a/packages/google-cloud-functions/src/v2beta/function_service_client.ts b/packages/google-cloud-functions/src/v2beta/function_service_client.ts new file mode 100644 index 00000000000..f99e3216505 --- /dev/null +++ b/packages/google-cloud-functions/src/v2beta/function_service_client.ts @@ -0,0 +1,2407 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta/function_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './function_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Functions is used to deploy functions that are executed by + * Google in response to various events. Data connected with that event is + * passed to a function as the input data. + * + * A **function** is a resource which describes a function that should be + * executed and how it is triggered. + * @class + * @memberof v2beta + */ +export class FunctionServiceClient { + 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}; + 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; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + functionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FunctionServiceClient. + * + * @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/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FunctionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.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 !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : 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 = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new IamClient(this._gaxGrpc, opts); + + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else 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); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + buildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + connectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectors/{connector}' + ), + functionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + triggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + workerPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workerPools/{worker_pool}' + ), + }; + + // 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 = { + listFunctions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'functions' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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. + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.Function' + ) as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.OperationMetadata' + ) as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.Function' + ) as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.OperationMetadata' + ) as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2beta.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata) + ), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata) + ), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v2beta.FunctionService', + 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 = gax.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.functionServiceStub) { + return this.functionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v2beta.FunctionService. + this.functionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.functions.v2beta.FunctionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v2beta.FunctionService, + 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 functionServiceStubMethods = [ + 'getFunction', + 'listFunctions', + 'createFunction', + 'updateFunction', + 'deleteFunction', + 'generateUploadUrl', + 'generateDownloadUrl', + 'listRuntimes', + ]; + for (const methodName of functionServiceStubMethods) { + const callPromise = this.functionServiceStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.functionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + 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 function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Function]{@link google.cloud.functions.v2beta.Function}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.get_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_GetFunction_async + */ + getFunction( + request?: protos.google.cloud.functions.v2beta.IGetFunctionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IGetFunctionRequest | undefined, + {} | undefined + ] + >; + getFunction( + request: protos.google.cloud.functions.v2beta.IGetFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2beta.IFunction, + | protos.google.cloud.functions.v2beta.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFunction( + request: protos.google.cloud.functions.v2beta.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v2beta.IFunction, + | protos.google.cloud.functions.v2beta.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFunction( + request?: protos.google.cloud.functions.v2beta.IGetFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2beta.IFunction, + | protos.google.cloud.functions.v2beta.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2beta.IFunction, + | protos.google.cloud.functions.v2beta.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IGetFunctionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFunction(request, options, callback); + } + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v2beta.GenerateUploadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.generate_upload_url.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async + */ + generateUploadUrl( + request?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + ( + | protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest + | undefined + ), + {} | undefined + ] + >; + generateUploadUrl( + request: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse, + ( + | protos.google.cloud.functions.v2beta.IGenerateUploadUrlRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.generateUploadUrl(request, options, callback); + } + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v2beta.GenerateDownloadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.generate_download_url.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async + */ + generateDownloadUrl( + request?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + ( + | protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest + | undefined + ), + {} | undefined + ] + >; + generateDownloadUrl( + request: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateDownloadUrl( + request?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse, + ( + | protos.google.cloud.functions.v2beta.IGenerateDownloadUrlRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.generateDownloadUrl(request, options, callback); + } + /** + * Returns a list of runtimes that are supported for the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the runtimes should be listed, + * specified in the format `projects/* /locations/*` + * @param {string} request.filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListRuntimesResponse]{@link google.cloud.functions.v2beta.ListRuntimesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.list_runtimes.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async + */ + listRuntimes( + request?: protos.google.cloud.functions.v2beta.IListRuntimesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + protos.google.cloud.functions.v2beta.IListRuntimesRequest | undefined, + {} | undefined + ] + >; + listRuntimes( + request: protos.google.cloud.functions.v2beta.IListRuntimesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + | protos.google.cloud.functions.v2beta.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + listRuntimes( + request: protos.google.cloud.functions.v2beta.IListRuntimesRequest, + callback: Callback< + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + | protos.google.cloud.functions.v2beta.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + listRuntimes( + request?: protos.google.cloud.functions.v2beta.IListRuntimesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + | protos.google.cloud.functions.v2beta.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + | protos.google.cloud.functions.v2beta.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2beta.IListRuntimesResponse, + protos.google.cloud.functions.v2beta.IListRuntimesRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listRuntimes(request, options, callback); + } + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + * @param {google.cloud.functions.v2beta.Function} request.function + * Required. Function to be created. + * @param {string} request.functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.create_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async + */ + createFunction( + request?: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createFunction( + request: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createFunction( + request: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createFunction( + request?: protos.google.cloud.functions.v2beta.ICreateFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.create_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async + */ + async checkCreateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v2beta.Function, + protos.google.cloud.functions.v2beta.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v2beta.Function, + protos.google.cloud.functions.v2beta.OperationMetadata + >; + } + /** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v2beta.Function} request.function + * Required. New version of the function. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.update_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async + */ + updateFunction( + request?: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateFunction( + request: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateFunction( + request: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateFunction( + request?: protos.google.cloud.functions.v2beta.IUpdateFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + 'function.name': request.function!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.update_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async + */ + async checkUpdateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v2beta.Function, + protos.google.cloud.functions.v2beta.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v2beta.Function, + protos.google.cloud.functions.v2beta.OperationMetadata + >; + } + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.delete_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async + */ + deleteFunction( + request?: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteFunction( + request: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteFunction( + request: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteFunction( + request?: protos.google.cloud.functions.v2beta.IDeleteFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2beta.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.delete_function.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async + */ + async checkDeleteFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v2beta.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v2beta.OperationMetadata + >; + } + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Function]{@link google.cloud.functions.v2beta.Function}. + * 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFunctions( + request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2beta.IFunction[], + protos.google.cloud.functions.v2beta.IListFunctionsRequest | null, + protos.google.cloud.functions.v2beta.IListFunctionsResponse + ] + >; + listFunctions( + request: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v2beta.IListFunctionsRequest, + | protos.google.cloud.functions.v2beta.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2beta.IFunction + > + ): void; + listFunctions( + request: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v2beta.IListFunctionsRequest, + | protos.google.cloud.functions.v2beta.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2beta.IFunction + > + ): void; + listFunctions( + request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.functions.v2beta.IListFunctionsRequest, + | protos.google.cloud.functions.v2beta.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2beta.IFunction + >, + callback?: PaginationCallback< + protos.google.cloud.functions.v2beta.IListFunctionsRequest, + | protos.google.cloud.functions.v2beta.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2beta.IFunction + > + ): Promise< + [ + protos.google.cloud.functions.v2beta.IFunction[], + protos.google.cloud.functions.v2beta.IListFunctionsRequest | null, + protos.google.cloud.functions.v2beta.IListFunctionsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFunctions(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 [Function]{@link google.cloud.functions.v2beta.Function} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listFunctions`, 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 and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Function]{@link google.cloud.functions.v2beta.Function}. 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2beta/function_service.list_functions.js + * region_tag:cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v2beta.IListFunctionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as unknown as RequestType, + 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 [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: 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 { + 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 + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + 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 { + 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 + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: 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 { + 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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * 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); + } + + /** + * Lists information about the supported locations for this service. 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 [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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, + options?: + | 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]> { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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, + options?: + | 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 { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified build resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + buildPath(project: string, location: string, build: string) { + return this.pathTemplates.buildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).project; + } + + /** + * Parse the location from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).location; + } + + /** + * Parse the build from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).build; + } + + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project: string, location: string, channel: string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified connector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connector + * @returns {string} Resource name string. + */ + connectorPath(project: string, location: string, connector: string) { + return this.pathTemplates.connectorPathTemplate.render({ + project: project, + location: location, + connector: connector, + }); + } + + /** + * Parse the project from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .project; + } + + /** + * Parse the location from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .location; + } + + /** + * Parse the connector from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the connector. + */ + matchConnectorFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .connector; + } + + /** + * Return a fully-qualified function resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + functionPath(project: string, location: string, functionParam: string) { + return this.pathTemplates.functionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * Parse the project from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).project; + } + + /** + * Parse the location from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).location; + } + + /** + * Parse the function from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).function; + } + + /** + * 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 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 repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project: string, location: string, repository: string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .repository; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project: string, location: string, service: string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project: string, topic: string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * Return a fully-qualified trigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + triggerPath(project: string, location: string, trigger: string) { + return this.pathTemplates.triggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).project; + } + + /** + * Parse the location from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).location; + } + + /** + * Parse the trigger from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; + } + + /** + * Return a fully-qualified workerPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} worker_pool + * @returns {string} Resource name string. + */ + workerPoolPath(project: string, location: string, workerPool: string) { + return this.pathTemplates.workerPoolPathTemplate.render({ + project: project, + location: location, + worker_pool: workerPool, + }); + } + + /** + * Parse the project from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .project; + } + + /** + * Parse the location from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .location; + } + + /** + * Parse the worker_pool from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the worker_pool. + */ + matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .worker_pool; + } + + /** + * 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.functionServiceStub && !this._terminated) { + return this.functionServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-functions/src/v2beta/function_service_client_config.json b/packages/google-cloud-functions/src/v2beta/function_service_client_config.json new file mode 100644 index 00000000000..d6bce91ead4 --- /dev/null +++ b/packages/google-cloud-functions/src/v2beta/function_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.functions.v2beta.FunctionService": { + "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": { + "GetFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFunctions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v2beta/function_service_proto_list.json b/packages/google-cloud-functions/src/v2beta/function_service_proto_list.json new file mode 100644 index 00000000000..a92a5d75e33 --- /dev/null +++ b/packages/google-cloud-functions/src/v2beta/function_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/functions/v2beta/functions.proto" +] diff --git a/packages/google-cloud-functions/src/v2beta/gapic_metadata.json b/packages/google-cloud-functions/src/v2beta/gapic_metadata.json new file mode 100644 index 00000000000..e66fe6e8e8b --- /dev/null +++ b/packages/google-cloud-functions/src/v2beta/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v2beta", + "libraryPackage": "@google-cloud/functions", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v2beta/index.ts b/packages/google-cloud-functions/src/v2beta/index.ts new file mode 100644 index 00000000000..a9477c6cf34 --- /dev/null +++ b/packages/google-cloud-functions/src/v2beta/index.ts @@ -0,0 +1,19 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {FunctionServiceClient} from './function_service_client'; diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts b/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts new file mode 100644 index 00000000000..971c84b76c5 --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts @@ -0,0 +1,3117 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 functionserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; + +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.FunctionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + functionserviceModule.v2alpha.FunctionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + functionserviceModule.v2alpha.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = functionserviceModule.v2alpha.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ); + client.innerApiCalls.getFunction = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2alpha.IFunction | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getFunction with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getFunction(request), expectedError); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFunction with closed client', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GetFunctionRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2alpha.IGenerateUploadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateUploadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2alpha.IGenerateDownloadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); + }); + + describe('listRuntimes', () => { + it('invokes listRuntimes without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimes without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2alpha.IListRuntimesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listRuntimes with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listRuntimes(request), expectedError); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimes with closed client', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listRuntimes(request), expectedError); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createFunction with call error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createFunction(request), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkCreateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkCreateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v2alpha.IFunction, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateFunction with call error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateFunction(request), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkUpdateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkUpdateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2alpha.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2alpha.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteFunction(request), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkDeleteFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkDeleteFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + ]; + client.innerApiCalls.listFunctions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2alpha.IFunction[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listFunctions with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listFunctions(request), expectedError); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + ]; + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2alpha.Function[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v2alpha.Function) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2alpha.Function[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v2alpha.Function) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2alpha.Function() + ), + ]; + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v2alpha.IFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v2alpha.IFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.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.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + 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.ListOperationsResponse[] = + []; + 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 functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.ListOperationsResponse[] = + []; + 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('build', () => { + const fakePath = '/rendered/path/build'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + build: 'buildValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.buildPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.buildPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('buildPath', () => { + const result = client.buildPath( + 'projectValue', + 'locationValue', + 'buildValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.buildPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBuildName', () => { + const result = client.matchProjectFromBuildName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBuildName', () => { + const result = client.matchLocationFromBuildName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBuildFromBuildName', () => { + const result = client.matchBuildFromBuildName(fakePath); + assert.strictEqual(result, 'buildValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('channel', () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + channel: 'channelValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'channelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('connector', () => { + const fakePath = '/rendered/path/connector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + connector: 'connectorValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.connectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('connectorPath', () => { + const result = client.connectorPath( + 'projectValue', + 'locationValue', + 'connectorValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.connectorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConnectorName', () => { + const result = client.matchProjectFromConnectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConnectorName', () => { + const result = client.matchLocationFromConnectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConnectorFromConnectorName', () => { + const result = client.matchConnectorFromConnectorName(fakePath); + assert.strictEqual(result, 'connectorValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('function', () => { + const fakePath = '/rendered/path/function'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + function: 'functionValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.functionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.functionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('functionPath', () => { + const result = client.functionPath( + 'projectValue', + 'locationValue', + 'functionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.functionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFunctionName', () => { + const result = client.matchProjectFromFunctionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFunctionName', () => { + const result = client.matchLocationFromFunctionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFunctionFromFunctionName', () => { + const result = client.matchFunctionFromFunctionName(fakePath); + assert.strictEqual(result, 'functionValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('repository', () => { + const fakePath = '/rendered/path/repository'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + repository: 'repositoryValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath( + 'projectValue', + 'locationValue', + 'repositoryValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, 'repositoryValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('service', () => { + const fakePath = '/rendered/path/service'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + service: 'serviceValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath( + 'projectValue', + 'locationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('topic', () => { + const fakePath = '/rendered/path/topic'; + const expectedParameters = { + project: 'projectValue', + topic: 'topicValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.topicPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath('projectValue', 'topicValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, 'topicValue'); + assert( + (client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('trigger', () => { + const fakePath = '/rendered/path/trigger'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + trigger: 'triggerValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.triggerPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.triggerPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('triggerPath', () => { + const result = client.triggerPath( + 'projectValue', + 'locationValue', + 'triggerValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.triggerPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTriggerName', () => { + const result = client.matchProjectFromTriggerName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTriggerName', () => { + const result = client.matchLocationFromTriggerName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTriggerFromTriggerName', () => { + const result = client.matchTriggerFromTriggerName(fakePath); + assert.strictEqual(result, 'triggerValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('workerPool', () => { + const fakePath = '/rendered/path/workerPool'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + worker_pool: 'workerPoolValue', + }; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workerPoolPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workerPoolPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workerPoolPath', () => { + const result = client.workerPoolPath( + 'projectValue', + 'locationValue', + 'workerPoolValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workerPoolPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWorkerPoolName', () => { + const result = client.matchProjectFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWorkerPoolName', () => { + const result = client.matchLocationFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkerPoolFromWorkerPoolName', () => { + const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'workerPoolValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts b/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts new file mode 100644 index 00000000000..5be910a77f8 --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts @@ -0,0 +1,3117 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 functionserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; + +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('v2beta.FunctionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + functionserviceModule.v2beta.FunctionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + functionserviceModule.v2beta.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = functionserviceModule.v2beta.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ); + client.innerApiCalls.getFunction = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2beta.IFunction | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getFunction with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getFunction(request), expectedError); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFunction with closed client', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GetFunctionRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2beta.IGenerateUploadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateUploadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2beta.IGenerateDownloadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); + }); + + describe('listRuntimes', () => { + it('invokes listRuntimes without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimes without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2beta.IListRuntimesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listRuntimes with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listRuntimes(request), expectedError); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimes with closed client', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListRuntimesRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listRuntimes(request), expectedError); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createFunction with call error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createFunction(request), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkCreateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkCreateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v2beta.IFunction, + protos.google.cloud.functions.v2beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateFunction with call error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateFunction(request), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkUpdateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkUpdateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2beta.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteFunction(request), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkDeleteFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkDeleteFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + ]; + client.innerApiCalls.listFunctions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2beta.IFunction[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listFunctions with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listFunctions(request), expectedError); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + ]; + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2beta.Function[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v2beta.Function) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2beta.Function[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v2beta.Function) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + generateSampleMessage( + new protos.google.cloud.functions.v2beta.Function() + ), + ]; + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v2beta.IFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2beta.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v2beta.IFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.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.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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 functionserviceModule.v2beta.FunctionServiceClient({ + 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.ListOperationsResponse[] = + []; + 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 functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.ListOperationsResponse[] = + []; + 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('build', () => { + const fakePath = '/rendered/path/build'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + build: 'buildValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.buildPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.buildPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('buildPath', () => { + const result = client.buildPath( + 'projectValue', + 'locationValue', + 'buildValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.buildPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBuildName', () => { + const result = client.matchProjectFromBuildName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBuildName', () => { + const result = client.matchLocationFromBuildName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBuildFromBuildName', () => { + const result = client.matchBuildFromBuildName(fakePath); + assert.strictEqual(result, 'buildValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('channel', () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + channel: 'channelValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'channelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('connector', () => { + const fakePath = '/rendered/path/connector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + connector: 'connectorValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.connectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('connectorPath', () => { + const result = client.connectorPath( + 'projectValue', + 'locationValue', + 'connectorValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.connectorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConnectorName', () => { + const result = client.matchProjectFromConnectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConnectorName', () => { + const result = client.matchLocationFromConnectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConnectorFromConnectorName', () => { + const result = client.matchConnectorFromConnectorName(fakePath); + assert.strictEqual(result, 'connectorValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('function', () => { + const fakePath = '/rendered/path/function'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + function: 'functionValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.functionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.functionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('functionPath', () => { + const result = client.functionPath( + 'projectValue', + 'locationValue', + 'functionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.functionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFunctionName', () => { + const result = client.matchProjectFromFunctionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFunctionName', () => { + const result = client.matchLocationFromFunctionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFunctionFromFunctionName', () => { + const result = client.matchFunctionFromFunctionName(fakePath); + assert.strictEqual(result, 'functionValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('repository', () => { + const fakePath = '/rendered/path/repository'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + repository: 'repositoryValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath( + 'projectValue', + 'locationValue', + 'repositoryValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, 'repositoryValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('service', () => { + const fakePath = '/rendered/path/service'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + service: 'serviceValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath( + 'projectValue', + 'locationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('topic', () => { + const fakePath = '/rendered/path/topic'; + const expectedParameters = { + project: 'projectValue', + topic: 'topicValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.topicPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath('projectValue', 'topicValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, 'topicValue'); + assert( + (client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('trigger', () => { + const fakePath = '/rendered/path/trigger'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + trigger: 'triggerValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.triggerPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.triggerPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('triggerPath', () => { + const result = client.triggerPath( + 'projectValue', + 'locationValue', + 'triggerValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.triggerPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTriggerName', () => { + const result = client.matchProjectFromTriggerName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTriggerName', () => { + const result = client.matchLocationFromTriggerName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTriggerFromTriggerName', () => { + const result = client.matchTriggerFromTriggerName(fakePath); + assert.strictEqual(result, 'triggerValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('workerPool', () => { + const fakePath = '/rendered/path/workerPool'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + worker_pool: 'workerPoolValue', + }; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workerPoolPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workerPoolPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workerPoolPath', () => { + const result = client.workerPoolPath( + 'projectValue', + 'locationValue', + 'workerPoolValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workerPoolPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWorkerPoolName', () => { + const result = client.matchProjectFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWorkerPoolName', () => { + const result = client.matchLocationFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkerPoolFromWorkerPoolName', () => { + const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'workerPoolValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); From cd1d3cbab79d678eebf18662bf8435087a87ff43 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 15:19:52 -0400 Subject: [PATCH 107/123] chore(main): release 2.1.0 (#170) See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-functions/CHANGELOG.md | 9 +++++++++ packages/google-cloud-functions/package.json | 2 +- .../v1/snippet_metadata.google.cloud.functions.v1.json | 2 +- .../snippet_metadata.google.cloud.functions.v2alpha.json | 2 +- .../snippet_metadata.google.cloud.functions.v2beta.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 894de89ff0e..02283b5140e 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [2.1.0](https://github.com/googleapis/nodejs-functions/compare/v2.0.0...v2.1.0) (2022-06-20) + + +### Features + +* added support for CMEK ([#166](https://github.com/googleapis/nodejs-functions/issues/166)) ([5f5e7e0](https://github.com/googleapis/nodejs-functions/commit/5f5e7e00282783095af067268972b72e68a17ebe)) +* generating GAPIC libraries for Google Cloud Functions v2alpha ([25c6047](https://github.com/googleapis/nodejs-functions/commit/25c60474a412fc26d1f91a12e47d259fcf3b7445)) +* generating GAPIC libraries for Google Cloud Functions v2beta ([#171](https://github.com/googleapis/nodejs-functions/issues/171)) ([25c6047](https://github.com/googleapis/nodejs-functions/commit/25c60474a412fc26d1f91a12e47d259fcf3b7445)) + ## [2.0.0](https://github.com/googleapis/nodejs-functions/compare/v1.3.0...v2.0.0) (2022-05-17) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 2e0f276a5ec..83b0148b071 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "2.0.0", + "version": "2.1.0", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index a82012d07a8..a0582e585d5 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.0.0", + "version": "2.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json index 540c4f9d123..d43f0829d7f 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json +++ b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.0.0", + "version": "2.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json index 5d04eaf0895..d01a34ce827 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json +++ b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.0.0", + "version": "2.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 035754fa4e3..1a2a7c9dc4a 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^2.0.0" + "@google-cloud/functions": "^2.1.0" }, "devDependencies": { "c8": "^7.1.0", From 60603687e3640db40f7631dc36e6ceb6a6728865 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 29 Jun 2022 10:55:20 -0400 Subject: [PATCH 108/123] feat: support regapic LRO (#172) Use gapic-generator-typescript v2.15.1. PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../src/v1/cloud_functions_service_client.ts | 40 +++++++++----- .../src/v2alpha/function_service_client.ts | 54 ++++++++++++++----- .../src/v2beta/function_service_client.ts | 54 ++++++++++++++----- 3 files changed, 112 insertions(+), 36 deletions(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index bc985634140..3d0e90268a0 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -72,7 +73,7 @@ export class CloudFunctionsServiceClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -95,11 +96,10 @@ export class CloudFunctionsServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -193,16 +193,32 @@ export class CloudFunctionsServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/operations', + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createFunctionResponse = protoFilesRoot.lookup( '.google.cloud.functions.v1.CloudFunction' diff --git a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts index 62943052035..dd71323241c 100644 --- a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -83,7 +84,7 @@ export class FunctionServiceClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -106,11 +107,10 @@ export class FunctionServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -227,16 +227,46 @@ export class FunctionServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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: '/v2alpha/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v2alpha/{resource=projects/*/locations/*/functions/*}:getIamPolicy', + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v2alpha/{resource=projects/*/locations/*/functions/*}:setIamPolicy', + body: '*', + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v2alpha/{resource=projects/*/locations/*/functions/*}:testIamPermissions', + body: '*', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2alpha/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2alpha/{name=projects/*/locations/*}/operations', + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createFunctionResponse = protoFilesRoot.lookup( '.google.cloud.functions.v2alpha.Function' diff --git a/packages/google-cloud-functions/src/v2beta/function_service_client.ts b/packages/google-cloud-functions/src/v2beta/function_service_client.ts index f99e3216505..d289f883309 100644 --- a/packages/google-cloud-functions/src/v2beta/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2beta/function_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -83,7 +84,7 @@ export class FunctionServiceClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -106,11 +107,10 @@ export class FunctionServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -227,16 +227,46 @@ export class FunctionServiceClient { }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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: '/v2beta/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v2beta/{resource=projects/*/locations/*/functions/*}:getIamPolicy', + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v2beta/{resource=projects/*/locations/*/functions/*}:setIamPolicy', + body: '*', + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v2beta/{resource=projects/*/locations/*/functions/*}:testIamPermissions', + body: '*', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta/{name=projects/*/locations/*}/operations', + }, + ]; + } this.operationsClient = this._gaxModule - .lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createFunctionResponse = protoFilesRoot.lookup( '.google.cloud.functions.v2beta.Function' From 4b41a51ce2a610b2014d8661d2b909dbf143899a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 8 Jul 2022 17:10:12 -0400 Subject: [PATCH 109/123] feat: generating GAPIC libraries for Google Cloud Functions v2beta (#175) PiperOrigin-RevId: 459309277 Source-Link: https://github.com/googleapis/googleapis/commit/2844793f71df766526ceeee8a35c90d7ac101fbe Source-Link: https://github.com/googleapis/googleapis-gen/commit/319987cc0e8789a368e34882271a92b0717c9c8f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzE5OTg3Y2MwZTg3ODlhMzY4ZTM0ODgyMjcxYTkyYjA3MTdjOWM4ZiJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google/cloud/functions/v2/functions.proto | 1037 ++ .../google-cloud-functions/protos/protos.d.ts | 3336 +++++++ .../google-cloud-functions/protos/protos.js | 8376 +++++++++++++++++ .../google-cloud-functions/protos/protos.json | 985 ++ .../v2/function_service.create_function.js | 72 + .../v2/function_service.delete_function.js | 59 + .../function_service.generate_download_url.js | 59 + .../function_service.generate_upload_url.js | 59 + .../v2/function_service.get_function.js | 58 + .../v2/function_service.list_functions.js | 87 + .../v2/function_service.list_runtimes.js | 64 + .../v2/function_service.update_function.js | 65 + ...et_metadata.google.cloud.functions.v2.json | 367 + packages/google-cloud-functions/src/index.ts | 5 +- .../src/v2/function_service_client.ts | 2413 +++++ .../v2/function_service_client_config.json | 58 + .../src/v2/function_service_proto_list.json | 3 + .../src/v2/gapic_metadata.json | 107 + .../google-cloud-functions/src/v2/index.ts | 19 + .../test/gapic_function_service_v2.ts | 3093 ++++++ 20 files changed, 20320 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-functions/protos/google/cloud/functions/v2/functions.proto create mode 100644 packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js create mode 100644 packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js create mode 100644 packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js create mode 100644 packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js create mode 100644 packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js create mode 100644 packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json create mode 100644 packages/google-cloud-functions/src/v2/function_service_client.ts create mode 100644 packages/google-cloud-functions/src/v2/function_service_client_config.json create mode 100644 packages/google-cloud-functions/src/v2/function_service_proto_list.json create mode 100644 packages/google-cloud-functions/src/v2/gapic_metadata.json create mode 100644 packages/google-cloud-functions/src/v2/index.ts create mode 100644 packages/google-cloud-functions/test/gapic_function_service_v2.ts diff --git a/packages/google-cloud-functions/protos/google/cloud/functions/v2/functions.proto b/packages/google-cloud-functions/protos/google/cloud/functions/v2/functions.proto new file mode 100644 index 00000000000..6af26ee880d --- /dev/null +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v2/functions.proto @@ -0,0 +1,1037 @@ +// 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.cloud.functions.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/any.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/functions/v2;functions"; +option java_multiple_files = true; +option java_outer_classname = "FunctionsProto"; +option java_package = "com.google.cloud.functions.v2"; +option objc_class_prefix = "GCF"; +option (google.api.resource_definition) = { + type: "artifactregistry.googleapis.com/Repository" + pattern: "projects/{project}/locations/{location}/repositories/{repository}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/Build" + pattern: "projects/{project}/locations/{location}/builds/{build}" +}; +option (google.api.resource_definition) = { + type: "cloudbuild.googleapis.com/WorkerPool" + pattern: "projects/{project}/locations/{location}/workerPools/{worker_pool}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" +}; +option (google.api.resource_definition) = { + type: "vpcaccess.googleapis.com/Connector" + pattern: "projects/{project}/locations/{location}/connectors/{connector}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" +}; +option (google.api.resource_definition) = { + type: "eventarc.googleapis.com/Channel" + pattern: "projects/{project}/locations/{location}/channels/{channel}" +}; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; +option (google.api.resource_definition) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" +}; + +// Google Cloud Functions is used to deploy functions that are executed by +// Google in response to various events. Data connected with that event is +// passed to a function as the input data. +// +// A **function** is a resource which describes a function that should be +// executed and how it is triggered. +service FunctionService { + option (google.api.default_host) = "cloudfunctions.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a function with the given name from the requested project. + rpc GetFunction(GetFunctionRequest) returns (Function) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of functions that belong to the requested project. + rpc ListFunctions(ListFunctionsRequest) returns (ListFunctionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/functions" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new function. If a function with the given name already exists in + // the specified project, the long running operation will return + // `ALREADY_EXISTS` error. + rpc CreateFunction(CreateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/functions" + body: "function" + }; + option (google.api.method_signature) = "parent,function,function_id"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2.Function" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Updates existing function. + rpc UpdateFunction(UpdateFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{function.name=projects/*/locations/*/functions/*}" + body: "function" + }; + option (google.api.method_signature) = "function,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.functions.v2.Function" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Deletes a function with the given name from the specified project. If the + // given function is used by some trigger, the trigger will be updated to + // remove this function. + rpc DeleteFunction(DeleteFunctionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/functions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.functions.v2.OperationMetadata" + }; + } + + // Returns a signed URL for uploading a function source code. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls. + // Once the function source code upload is complete, the used signed + // URL should be provided in CreateFunction or UpdateFunction request + // as a reference to the function source code. + // + // When uploading source code to the generated signed URL, please follow + // these restrictions: + // + // * Source file type should be a zip file. + // * No credentials should be attached - the signed URLs provide access to the + // target bucket using internal service identity; if credentials were + // attached, the identity from the credentials would be used, but that + // identity does not have permissions to upload files to the URL. + // + // When making a HTTP PUT request, these two headers need to be specified: + // + // * `content-type: application/zip` + // + // And this header SHOULD NOT be specified: + // + // * `Authorization: Bearer YOUR_TOKEN` + rpc GenerateUploadUrl(GenerateUploadUrlRequest) returns (GenerateUploadUrlResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl" + body: "*" + }; + } + + // Returns a signed URL for downloading deployed function source code. + // The URL is only valid for a limited period and should be used within + // 30 minutes of generation. + // For more information about the signed URL usage see: + // https://cloud.google.com/storage/docs/access-control/signed-urls + rpc GenerateDownloadUrl(GenerateDownloadUrlRequest) returns (GenerateDownloadUrlResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl" + body: "*" + }; + } + + // Returns a list of runtimes that are supported for the requested project. + rpc ListRuntimes(ListRuntimesRequest) returns (ListRuntimesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/runtimes" + }; + option (google.api.method_signature) = "parent"; + } +} + +// The environment the function is hosted on. +enum Environment { + // Unspecified + ENVIRONMENT_UNSPECIFIED = 0; + + // Gen 1 + GEN_1 = 1; + + // Gen 2 + GEN_2 = 2; +} + +// Describes a Cloud Function that contains user computation executed in +// response to an event. It encapsulates function and trigger configurations. +message Function { + option (google.api.resource) = { + type: "cloudfunctions.googleapis.com/Function" + pattern: "projects/{project}/locations/{location}/functions/{function}" + plural: "functions" + singular: "function" + }; + + // Describes the current state of the function. + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Function has been successfully deployed and is serving. + ACTIVE = 1; + + // Function deployment failed and the function is not serving. + FAILED = 2; + + // Function is being created or updated. + DEPLOYING = 3; + + // Function is being deleted. + DELETING = 4; + + // Function deployment failed and the function serving state is undefined. + // The function should be updated or deleted to move it out of this state. + UNKNOWN = 5; + } + + // A user-defined name of the function. Function names must be unique + // globally and match pattern `projects/*/locations/*/functions/*` + string name = 1; + + // Describe whether the function is gen1 or gen2. + Environment environment = 10; + + // User-provided description of a function. + string description = 2; + + // Describes the Build step of the function that builds a container from the + // given source. + BuildConfig build_config = 3; + + // Describes the Service being deployed. Currently deploys services to Cloud + // Run (fully managed). + ServiceConfig service_config = 4; + + // An Eventarc trigger managed by Google Cloud Functions that fires events in + // response to a condition in another service. + EventTrigger event_trigger = 5; + + // Output only. State of the function. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp of a Cloud Function. + google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with this Cloud Function. + map labels = 8; + + // Output only. State Messages for this Cloud Function. + repeated StateMessage state_messages = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Informational messages about the state of the Cloud Function or Operation. +message StateMessage { + // Severity of the state message. + enum Severity { + // Not specified. Invalid severity. + SEVERITY_UNSPECIFIED = 0; + + // ERROR-level severity. + ERROR = 1; + + // WARNING-level severity. + WARNING = 2; + + // INFO-level severity. + INFO = 3; + } + + // Severity of the state message. + Severity severity = 1; + + // One-word CamelCase type of the state message. + string type = 2; + + // The message. + string message = 3; +} + +// Location of the source in an archive file in Google Cloud Storage. +message StorageSource { + // Google Cloud Storage bucket containing the source (see + // [Bucket Name + // Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + string bucket = 1; + + // Google Cloud Storage object containing the source. + // + // This object must be a gzipped archive file (`.tar.gz`) containing source to + // build. + string object = 2; + + // Google Cloud Storage generation for the object. If the generation is + // omitted, the latest generation will be used. + int64 generation = 3; +} + +// Location of the source in a Google Cloud Source Repository. +message RepoSource { + // A revision within the Cloud Source Repository must be specified in + // one of these ways. + oneof revision { + // Regex matching branches to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string branch_name = 3; + + // Regex matching tags to build. + // + // The syntax of the regular expressions accepted is the syntax accepted by + // RE2 and described at https://github.com/google/re2/wiki/Syntax + string tag_name = 4; + + // Explicit commit SHA to build. + string commit_sha = 5; + } + + // ID of the project that owns the Cloud Source Repository. If omitted, the + // project ID requesting the build is assumed. + string project_id = 1; + + // Name of the Cloud Source Repository. + string repo_name = 2; + + // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's `dir` is specified and is an + // absolute path, this value is ignored for that step's execution. + // eg. helloworld (no leading slash allowed) + string dir = 6; + + // Only trigger a build if the revision regex does NOT match the revision + // regex. + bool invert_regex = 7; +} + +// The location of the function source code. +message Source { + // Location of the source. + // At least one source needs to be provided for the deployment to succeed. + oneof source { + // If provided, get the source from this location in Google Cloud Storage. + StorageSource storage_source = 1; + + // If provided, get the source from this location in a Cloud Source + // Repository. + RepoSource repo_source = 2; + } +} + +// Provenance of the source. Ways to find the original source, or verify that +// some source was used for this build. +message SourceProvenance { + // A copy of the build's `source.storage_source`, if exists, with any + // generations resolved. + StorageSource resolved_storage_source = 1; + + // A copy of the build's `source.repo_source`, if exists, with any + // revisions resolved. + RepoSource resolved_repo_source = 2; +} + +// Describes the Build step of the function that builds a container from the +// given source. +message BuildConfig { + // Output only. The Cloud Build name of the latest successful deployment of the + // function. + string build = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/Build" + } + ]; + + // The runtime in which to run the function. Required when deploying a new + // function, optional when updating an existing function. For a complete + // list of possible choices, see the + // [`gcloud` command + // reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). + string runtime = 2; + + // The name of the function (as defined in source code) that will be + // executed. Defaults to the resource name suffix, if not specified. For + // backward compatibility, if function with given name is not found, then the + // system will try to use function named "function". + // For Node.js this is name of a function exported by the module specified + // in `source_location`. + string entry_point = 3; + + // The location of the function source code. + Source source = 4; + + // Output only. A permanent fixed identifier for source. + SourceProvenance source_provenance = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Name of the Cloud Build Custom Worker Pool that should be used to build the + // function. The format of this field is + // `projects/{project}/locations/{region}/workerPools/{workerPool}` where + // {project} and {region} are the project id and region respectively where the + // worker pool is defined and {workerPool} is the short name of the worker + // pool. + // + // If the project id is not the same as the function, then the Cloud + // Functions Service Agent + // (service-@gcf-admin-robot.iam.gserviceaccount.com) must be + // granted the role Cloud Build Custom Workers Builder + // (roles/cloudbuild.customworkers.builder) in the project. + string worker_pool = 5 [(google.api.resource_reference) = { + type: "cloudbuild.googleapis.com/WorkerPool" + }]; + + // User-provided build-time environment variables for the function + map environment_variables = 6; + + // Optional. User managed repository created in Artifact Registry optionally with a + // customer managed encryption key. This is the repository to which the + // function docker image will be pushed after it is built by Cloud Build. + // If unspecified, GCF will create and use a repository named 'gcf-artifacts' + // for every deployed region. + // + // It must match the pattern + // `projects/{project}/locations/{location}/repositories/{repository}`. + // + // Cross-project repositories are not supported. + // Cross-location repositories are not supported. + // Repository format must be 'DOCKER'. + string docker_repository = 7 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "artifactregistry.googleapis.com/Repository" + } + ]; +} + +// Describes the Service being deployed. +// Currently Supported : Cloud Run (fully managed). +message ServiceConfig { + // Available egress settings. + // + // This controls what traffic is diverted through the VPC Access Connector + // resource. By default PRIVATE_RANGES_ONLY will be used. + enum VpcConnectorEgressSettings { + // Unspecified. + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; + + // Use the VPC Access Connector only for private IP space from RFC1918. + PRIVATE_RANGES_ONLY = 1; + + // Force the use of VPC Access Connector for all egress traffic from the + // function. + ALL_TRAFFIC = 2; + } + + // Available ingress settings. + // + // This controls what traffic can reach the function. + // + // If unspecified, ALLOW_ALL will be used. + enum IngressSettings { + // Unspecified. + INGRESS_SETTINGS_UNSPECIFIED = 0; + + // Allow HTTP traffic from public and private sources. + ALLOW_ALL = 1; + + // Allow HTTP traffic from only private VPC sources. + ALLOW_INTERNAL_ONLY = 2; + + // Allow HTTP traffic from private VPC sources and through GCLB. + ALLOW_INTERNAL_AND_GCLB = 3; + } + + // Output only. Name of the service associated with a Function. + // The format of this field is + // `projects/{project}/locations/{region}/services/{service}` + string service = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "run.googleapis.com/Service" + } + ]; + + // The function execution timeout. Execution is considered failed and + // can be terminated if the function is not completed at the end of the + // timeout period. Defaults to 60 seconds. + int32 timeout_seconds = 2; + + // The amount of memory available for a function. + // Defaults to 256M. Supported units are k, M, G, Mi, Gi. If no unit is + // supplied the value is interpreted as bytes. + // See + // https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go + // a full description. + string available_memory = 13; + + // Environment variables that shall be available during function execution. + map environment_variables = 4; + + // The limit on the maximum number of function instances that may coexist at a + // given time. + // + // In some cases, such as rapid traffic surges, Cloud Functions may, for a + // short period of time, create more instances than the specified max + // instances limit. If your function cannot tolerate this temporary behavior, + // you may want to factor in a safety margin and set a lower max instances + // value than your function can tolerate. + // + // See the [Max + // Instances](https://cloud.google.com/functions/docs/max-instances) Guide for + // more details. + int32 max_instance_count = 5; + + // The limit on the minimum number of function instances that may coexist at a + // given time. + // + // Function instances are kept in idle state for a short period after they + // finished executing the request to reduce cold start time for subsequent + // requests. Setting a minimum instance count will ensure that the given + // number of instances are kept running in idle state always. This can help + // with cold start times when jump in incoming request count occurs after the + // idle instance would have been stopped in the default case. + int32 min_instance_count = 12; + + // The Serverless VPC Access connector that this cloud function can connect + // to. The format of this field is `projects/*/locations/*/connectors/*`. + string vpc_connector = 6 [(google.api.resource_reference) = { + type: "vpcaccess.googleapis.com/Connector" + }]; + + // The egress settings for the connector, controlling what traffic is diverted + // through it. + VpcConnectorEgressSettings vpc_connector_egress_settings = 7; + + // The ingress settings for the function, controlling what traffic can reach + // it. + IngressSettings ingress_settings = 8; + + // Output only. URI of the Service deployed. + string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The email of the service's service account. If empty, defaults to + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 10; + + // Whether 100% of traffic is routed to the latest revision. + // On CreateFunction and UpdateFunction, when set to true, the revision being + // deployed will serve 100% of traffic, ignoring any traffic split settings, + // if any. On GetFunction, true will be returned if the latest revision is + // serving 100% of traffic. + bool all_traffic_on_latest_revision = 16; + + // Secret environment variables configuration. + repeated SecretEnvVar secret_environment_variables = 17; + + // Secret volumes configuration. + repeated SecretVolume secret_volumes = 19; + + // Output only. The name of service revision. + string revision = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for a secret environment variable. It has the information +// necessary to fetch the secret value from secret manager and expose it as an +// environment variable. +message SecretEnvVar { + // Name of the environment variable. + string key = 1; + + // Project identifier (preferably project number but can also be the + // project ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // Version of the secret (version number or the string 'latest'). It is + // recommended to use a numeric version for secret environment variables as + // any updates to the secret value is not reflected until new instances + // start. + string version = 4; +} + +// Configuration for a secret volume. It has the information necessary to fetch +// the secret value from secret manager and make it available as files mounted +// at the requested paths within the application container. +message SecretVolume { + // Configuration for a single version. + message SecretVersion { + // Version of the secret (version number or the string 'latest'). It is + // preferable to use `latest` version with secret volumes as secret value + // changes are reflected immediately. + string version = 1; + + // Relative path of the file under the mount path where the secret value for + // this version will be fetched and made available. For example, setting the + // mount_path as '/etc/secrets' and path as `secret_foo` would mount the + // secret value file at `/etc/secrets/secret_foo`. + string path = 2; + } + + // The path within the container to mount the secret volume. For example, + // setting the mount_path as `/etc/secrets` would mount the secret value files + // under the `/etc/secrets` directory. This directory will also be completely + // shadowed and unavailable to mount any other secrets. + // Recommended mount path: /etc/secrets + string mount_path = 1; + + // Project identifier (preferably project number but can also be the project + // ID) of the project that contains the secret. If not set, it is + // assumed that the secret is in the same project as the function. + string project_id = 2; + + // Name of the secret in secret manager (not the full resource name). + string secret = 3; + + // List of secret versions to mount for this secret. If empty, the `latest` + // version of the secret will be made available in a file named after the + // secret under the mount point. + repeated SecretVersion versions = 4; +} + +// Describes EventTrigger, used to request events to be sent from another +// service. +message EventTrigger { + // Describes the retry policy in case of function's execution failure. + // Retried execution is charged as any other execution. + enum RetryPolicy { + // Not specified. + RETRY_POLICY_UNSPECIFIED = 0; + + // Do not retry. + RETRY_POLICY_DO_NOT_RETRY = 1; + + // Retry on any failure, retry up to 7 days with an exponential backoff + // (capped at 10 seconds). + RETRY_POLICY_RETRY = 2; + } + + // Output only. The resource name of the Eventarc trigger. The format of this field is + // `projects/{project}/locations/{region}/triggers/{trigger}`. + string trigger = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The region that the trigger will be in. The trigger will only receive + // events originating in this region. It can be the same + // region as the function, a different region or multi-region, or the global + // region. If not provided, defaults to the same region as the function. + string trigger_region = 2; + + // Required. The type of event to observe. For example: + // `google.cloud.audit.log.v1.written` or + // `google.cloud.pubsub.topic.v1.messagePublished`. + string event_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Criteria used to filter events. + repeated EventFilter event_filters = 4; + + // Optional. The name of a Pub/Sub topic in the same project that will be used + // as the transport topic for the event delivery. Format: + // `projects/{project}/topics/{topic}`. + // + // This is only valid for events of type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here + // will not be deleted at function deletion. + string pubsub_topic = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + } + ]; + + // Optional. The email of the trigger's service account. The service account must have + // permission to invoke Cloud Run services, the permission is + // `run.routes.invoke`. + // If empty, defaults to the Compute Engine default service account: + // `{project_number}-compute@developer.gserviceaccount.com`. + string service_account_email = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If unset, then defaults to ignoring failures (i.e. not retrying them). + RetryPolicy retry_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for the `GetFunction` method. +message GetFunctionRequest { + // Required. The name of the function which details should be obtained. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request for the `ListFunctions` method. +message ListFunctionsRequest { + // Required. The project and location from which the function should be listed, + // specified in the format `projects/*/locations/*` + // If you want to list functions in all locations, use "-" in place of a + // location. When listing functions in all locations, if one or more + // location(s) are unreachable, the response will contain functions from all + // reachable locations along with the names of any unreachable locations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudfunctions.googleapis.com/Function" + } + ]; + + // Maximum number of functions to return per call. + int32 page_size = 2; + + // The value returned by the last + // `ListFunctionsResponse`; indicates that + // this is a continuation of a prior `ListFunctions` call, and that the + // system should return the next page of data. + string page_token = 3; + + // The filter for Functions that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 4; + + // The sorting order of the resources returned. Value should be a comma + // separated list of fields. The default sorting oder is ascending. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Response for the `ListFunctions` method. +message ListFunctionsResponse { + // The functions that match the request. + repeated Function functions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. The response does not include any + // functions from these locations. + repeated string unreachable = 3; +} + +// Request for the `CreateFunction` method. +message CreateFunctionRequest { + // Required. The project and location in which the function should be created, specified + // in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Function to be created. + Function function = 2 [(google.api.field_behavior) = REQUIRED]; + + // The ID to use for the function, which will become the final component of + // the function's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + string function_id = 3; +} + +// Request for the `UpdateFunction` method. +message UpdateFunctionRequest { + // Required. New version of the function. + Function function = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If no field mask is provided, all provided fields in the request will be + // updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request for the `DeleteFunction` method. +message DeleteFunctionRequest { + // Required. The name of the function which should be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Request of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlRequest { + // Required. The project and location in which the Google Cloud Storage signed URL + // should be generated, specified in the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; +} + +// Response of `GenerateSourceUploadUrl` method. +message GenerateUploadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for a + // function source code upload. The uploaded file should be a zip archive + // which contains a function. + string upload_url = 1; + + // The location of the source code in the upload bucket. + // + // Once the archive is uploaded using the `upload_url` use this field to + // set the `function.build_config.source.storage_source` + // during CreateFunction and UpdateFunction. + // + // Generation defaults to 0, as Cloud Storage provides a new generation only + // upon uploading a new object or version of an object. + StorageSource storage_source = 2; +} + +// Request of `GenerateDownloadUrl` method. +message GenerateDownloadUrlRequest { + // Required. The name of function for which source code Google Cloud Storage signed + // URL should be generated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/Function" + } + ]; +} + +// Response of `GenerateDownloadUrl` method. +message GenerateDownloadUrlResponse { + // The generated Google Cloud Storage signed URL that should be used for + // function source code download. + string download_url = 1; +} + +// Request for the `ListRuntimes` method. +message ListRuntimesRequest { + // Required. The project and location from which the runtimes should be listed, + // specified in the format `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The filter for Runtimes that match the filter expression, + // following the syntax outlined in https://google.aip.dev/160. + string filter = 2; +} + +// Response for the `ListRuntimes` method. +message ListRuntimesResponse { + // Describes a runtime and any special information (e.g., deprecation status) + // related to it. + message Runtime { + // The name of the runtime, e.g., 'go113', 'nodejs12', etc. + string name = 1; + + // The user facing name, eg 'Go 1.13', 'Node.js 12', etc. + string display_name = 5; + + // The stage of life this runtime is in, e.g., BETA, GA, etc. + RuntimeStage stage = 2; + + // Warning messages, e.g., a deprecation warning. + repeated string warnings = 3; + + // The environment for the runtime. + Environment environment = 4; + } + + // The various stages that a runtime can be in. + enum RuntimeStage { + // Not specified. + RUNTIME_STAGE_UNSPECIFIED = 0; + + // The runtime is in development. + DEVELOPMENT = 1; + + // The runtime is in the Alpha stage. + ALPHA = 2; + + // The runtime is in the Beta stage. + BETA = 3; + + // The runtime is generally available. + GA = 4; + + // The runtime is deprecated. + DEPRECATED = 5; + + // The runtime is no longer supported. + DECOMMISSIONED = 6; + } + + // The runtimes that match the request. + repeated Runtime runtimes = 1; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_detail = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancel_requested = 6; + + // API version used to start the operation. + string api_version = 7; + + // The original request that started the operation. + google.protobuf.Any request_resource = 8; + + // Mechanism for reporting in-progress stages + repeated Stage stages = 9; +} + +// Each Stage of the deployment process +message Stage { + // Possible names for a Stage + enum Name { + // Not specified. Invalid name. + NAME_UNSPECIFIED = 0; + + // Artifact Regsitry Stage + ARTIFACT_REGISTRY = 1; + + // Build Stage + BUILD = 2; + + // Service Stage + SERVICE = 3; + + // Trigger Stage + TRIGGER = 4; + + // Service Rollback Stage + SERVICE_ROLLBACK = 5; + + // Trigger Rollback Stage + TRIGGER_ROLLBACK = 6; + } + + // Possible states for a Stage + enum State { + // Not specified. Invalid state. + STATE_UNSPECIFIED = 0; + + // Stage has not started. + NOT_STARTED = 1; + + // Stage is in progress. + IN_PROGRESS = 2; + + // Stage has completed. + COMPLETE = 3; + } + + // Name of the Stage. This will be unique for each Stage. + Name name = 1; + + // Message describing the Stage + string message = 2; + + // Current state of the Stage + State state = 3; + + // Resource of the Stage + string resource = 4; + + // Link to the current Stage resource + string resource_uri = 5; + + // State messages from the current Stage. + repeated StateMessage state_messages = 6; +} diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index e2e45ccb285..d4641902871 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -2696,6 +2696,3342 @@ export namespace google { } } + /** Namespace v2. */ + namespace v2 { + + /** Represents a FunctionService */ + class FunctionService extends $protobuf.rpc.Service { + + /** + * Constructs a new FunctionService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new FunctionService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): FunctionService; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Function + */ + public getFunction(request: google.cloud.functions.v2.IGetFunctionRequest, callback: google.cloud.functions.v2.FunctionService.GetFunctionCallback): void; + + /** + * Calls GetFunction. + * @param request GetFunctionRequest message or plain object + * @returns Promise + */ + public getFunction(request: google.cloud.functions.v2.IGetFunctionRequest): Promise; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListFunctionsResponse + */ + public listFunctions(request: google.cloud.functions.v2.IListFunctionsRequest, callback: google.cloud.functions.v2.FunctionService.ListFunctionsCallback): void; + + /** + * Calls ListFunctions. + * @param request ListFunctionsRequest message or plain object + * @returns Promise + */ + public listFunctions(request: google.cloud.functions.v2.IListFunctionsRequest): Promise; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createFunction(request: google.cloud.functions.v2.ICreateFunctionRequest, callback: google.cloud.functions.v2.FunctionService.CreateFunctionCallback): void; + + /** + * Calls CreateFunction. + * @param request CreateFunctionRequest message or plain object + * @returns Promise + */ + public createFunction(request: google.cloud.functions.v2.ICreateFunctionRequest): Promise; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateFunction(request: google.cloud.functions.v2.IUpdateFunctionRequest, callback: google.cloud.functions.v2.FunctionService.UpdateFunctionCallback): void; + + /** + * Calls UpdateFunction. + * @param request UpdateFunctionRequest message or plain object + * @returns Promise + */ + public updateFunction(request: google.cloud.functions.v2.IUpdateFunctionRequest): Promise; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteFunction(request: google.cloud.functions.v2.IDeleteFunctionRequest, callback: google.cloud.functions.v2.FunctionService.DeleteFunctionCallback): void; + + /** + * Calls DeleteFunction. + * @param request DeleteFunctionRequest message or plain object + * @returns Promise + */ + public deleteFunction(request: google.cloud.functions.v2.IDeleteFunctionRequest): Promise; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + */ + public generateUploadUrl(request: google.cloud.functions.v2.IGenerateUploadUrlRequest, callback: google.cloud.functions.v2.FunctionService.GenerateUploadUrlCallback): void; + + /** + * Calls GenerateUploadUrl. + * @param request GenerateUploadUrlRequest message or plain object + * @returns Promise + */ + public generateUploadUrl(request: google.cloud.functions.v2.IGenerateUploadUrlRequest): Promise; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + */ + public generateDownloadUrl(request: google.cloud.functions.v2.IGenerateDownloadUrlRequest, callback: google.cloud.functions.v2.FunctionService.GenerateDownloadUrlCallback): void; + + /** + * Calls GenerateDownloadUrl. + * @param request GenerateDownloadUrlRequest message or plain object + * @returns Promise + */ + public generateDownloadUrl(request: google.cloud.functions.v2.IGenerateDownloadUrlRequest): Promise; + + /** + * Calls ListRuntimes. + * @param request ListRuntimesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRuntimesResponse + */ + public listRuntimes(request: google.cloud.functions.v2.IListRuntimesRequest, callback: google.cloud.functions.v2.FunctionService.ListRuntimesCallback): void; + + /** + * Calls ListRuntimes. + * @param request ListRuntimesRequest message or plain object + * @returns Promise + */ + public listRuntimes(request: google.cloud.functions.v2.IListRuntimesRequest): Promise; + } + + namespace FunctionService { + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#getFunction}. + * @param error Error, if any + * @param [response] Function + */ + type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v2.Function) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#listFunctions}. + * @param error Error, if any + * @param [response] ListFunctionsResponse + */ + type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v2.ListFunctionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#createFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#updateFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#deleteFunction}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateUploadUrl}. + * @param error Error, if any + * @param [response] GenerateUploadUrlResponse + */ + type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2.GenerateUploadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateDownloadUrl}. + * @param error Error, if any + * @param [response] GenerateDownloadUrlResponse + */ + type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2.GenerateDownloadUrlResponse) => void; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#listRuntimes}. + * @param error Error, if any + * @param [response] ListRuntimesResponse + */ + type ListRuntimesCallback = (error: (Error|null), response?: google.cloud.functions.v2.ListRuntimesResponse) => void; + } + + /** Environment enum. */ + enum Environment { + ENVIRONMENT_UNSPECIFIED = 0, + GEN_1 = 1, + GEN_2 = 2 + } + + /** Properties of a Function. */ + interface IFunction { + + /** Function name */ + name?: (string|null); + + /** Function environment */ + environment?: (google.cloud.functions.v2.Environment|keyof typeof google.cloud.functions.v2.Environment|null); + + /** Function description */ + description?: (string|null); + + /** Function buildConfig */ + buildConfig?: (google.cloud.functions.v2.IBuildConfig|null); + + /** Function serviceConfig */ + serviceConfig?: (google.cloud.functions.v2.IServiceConfig|null); + + /** Function eventTrigger */ + eventTrigger?: (google.cloud.functions.v2.IEventTrigger|null); + + /** Function state */ + state?: (google.cloud.functions.v2.Function.State|keyof typeof google.cloud.functions.v2.Function.State|null); + + /** Function updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Function labels */ + labels?: ({ [k: string]: string }|null); + + /** Function stateMessages */ + stateMessages?: (google.cloud.functions.v2.IStateMessage[]|null); + } + + /** Represents a Function. */ + class Function implements IFunction { + + /** + * Constructs a new Function. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IFunction); + + /** Function name. */ + public name: string; + + /** Function environment. */ + public environment: (google.cloud.functions.v2.Environment|keyof typeof google.cloud.functions.v2.Environment); + + /** Function description. */ + public description: string; + + /** Function buildConfig. */ + public buildConfig?: (google.cloud.functions.v2.IBuildConfig|null); + + /** Function serviceConfig. */ + public serviceConfig?: (google.cloud.functions.v2.IServiceConfig|null); + + /** Function eventTrigger. */ + public eventTrigger?: (google.cloud.functions.v2.IEventTrigger|null); + + /** Function state. */ + public state: (google.cloud.functions.v2.Function.State|keyof typeof google.cloud.functions.v2.Function.State); + + /** Function updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Function labels. */ + public labels: { [k: string]: string }; + + /** Function stateMessages. */ + public stateMessages: google.cloud.functions.v2.IStateMessage[]; + + /** + * Creates a new Function instance using the specified properties. + * @param [properties] Properties to set + * @returns Function instance + */ + public static create(properties?: google.cloud.functions.v2.IFunction): google.cloud.functions.v2.Function; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.cloud.functions.v2.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Function.verify|verify} messages. + * @param message Function message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IFunction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Function message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.Function; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.Function; + + /** + * Verifies a Function message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Function + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.Function; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @param message Function + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.Function, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Function to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Function { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACTIVE = 1, + FAILED = 2, + DEPLOYING = 3, + DELETING = 4, + UNKNOWN = 5 + } + } + + /** Properties of a StateMessage. */ + interface IStateMessage { + + /** StateMessage severity */ + severity?: (google.cloud.functions.v2.StateMessage.Severity|keyof typeof google.cloud.functions.v2.StateMessage.Severity|null); + + /** StateMessage type */ + type?: (string|null); + + /** StateMessage message */ + message?: (string|null); + } + + /** Represents a StateMessage. */ + class StateMessage implements IStateMessage { + + /** + * Constructs a new StateMessage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IStateMessage); + + /** StateMessage severity. */ + public severity: (google.cloud.functions.v2.StateMessage.Severity|keyof typeof google.cloud.functions.v2.StateMessage.Severity); + + /** StateMessage type. */ + public type: string; + + /** StateMessage message. */ + public message: string; + + /** + * Creates a new StateMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns StateMessage instance + */ + public static create(properties?: google.cloud.functions.v2.IStateMessage): google.cloud.functions.v2.StateMessage; + + /** + * Encodes the specified StateMessage message. Does not implicitly {@link google.cloud.functions.v2.StateMessage.verify|verify} messages. + * @param message StateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IStateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StateMessage message, length delimited. Does not implicitly {@link google.cloud.functions.v2.StateMessage.verify|verify} messages. + * @param message StateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IStateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StateMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.StateMessage; + + /** + * Decodes a StateMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.StateMessage; + + /** + * Verifies a StateMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StateMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StateMessage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.StateMessage; + + /** + * Creates a plain object from a StateMessage message. Also converts values to other types if specified. + * @param message StateMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.StateMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StateMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace StateMessage { + + /** Severity enum. */ + enum Severity { + SEVERITY_UNSPECIFIED = 0, + ERROR = 1, + WARNING = 2, + INFO = 3 + } + } + + /** Properties of a StorageSource. */ + interface IStorageSource { + + /** StorageSource bucket */ + bucket?: (string|null); + + /** StorageSource object */ + object?: (string|null); + + /** StorageSource generation */ + generation?: (number|Long|string|null); + } + + /** Represents a StorageSource. */ + class StorageSource implements IStorageSource { + + /** + * Constructs a new StorageSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IStorageSource); + + /** StorageSource bucket. */ + public bucket: string; + + /** StorageSource object. */ + public object: string; + + /** StorageSource generation. */ + public generation: (number|Long|string); + + /** + * Creates a new StorageSource instance using the specified properties. + * @param [properties] Properties to set + * @returns StorageSource instance + */ + public static create(properties?: google.cloud.functions.v2.IStorageSource): google.cloud.functions.v2.StorageSource; + + /** + * Encodes the specified StorageSource message. Does not implicitly {@link google.cloud.functions.v2.StorageSource.verify|verify} messages. + * @param message StorageSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IStorageSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StorageSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2.StorageSource.verify|verify} messages. + * @param message StorageSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IStorageSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StorageSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.StorageSource; + + /** + * Decodes a StorageSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.StorageSource; + + /** + * Verifies a StorageSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StorageSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StorageSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.StorageSource; + + /** + * Creates a plain object from a StorageSource message. Also converts values to other types if specified. + * @param message StorageSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.StorageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StorageSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RepoSource. */ + interface IRepoSource { + + /** RepoSource branchName */ + branchName?: (string|null); + + /** RepoSource tagName */ + tagName?: (string|null); + + /** RepoSource commitSha */ + commitSha?: (string|null); + + /** RepoSource projectId */ + projectId?: (string|null); + + /** RepoSource repoName */ + repoName?: (string|null); + + /** RepoSource dir */ + dir?: (string|null); + + /** RepoSource invertRegex */ + invertRegex?: (boolean|null); + } + + /** Represents a RepoSource. */ + class RepoSource implements IRepoSource { + + /** + * Constructs a new RepoSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IRepoSource); + + /** RepoSource branchName. */ + public branchName?: (string|null); + + /** RepoSource tagName. */ + public tagName?: (string|null); + + /** RepoSource commitSha. */ + public commitSha?: (string|null); + + /** RepoSource projectId. */ + public projectId: string; + + /** RepoSource repoName. */ + public repoName: string; + + /** RepoSource dir. */ + public dir: string; + + /** RepoSource invertRegex. */ + public invertRegex: boolean; + + /** RepoSource revision. */ + public revision?: ("branchName"|"tagName"|"commitSha"); + + /** + * Creates a new RepoSource instance using the specified properties. + * @param [properties] Properties to set + * @returns RepoSource instance + */ + public static create(properties?: google.cloud.functions.v2.IRepoSource): google.cloud.functions.v2.RepoSource; + + /** + * Encodes the specified RepoSource message. Does not implicitly {@link google.cloud.functions.v2.RepoSource.verify|verify} messages. + * @param message RepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RepoSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2.RepoSource.verify|verify} messages. + * @param message RepoSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IRepoSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RepoSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.RepoSource; + + /** + * Decodes a RepoSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.RepoSource; + + /** + * Verifies a RepoSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RepoSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RepoSource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.RepoSource; + + /** + * Creates a plain object from a RepoSource message. Also converts values to other types if specified. + * @param message RepoSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.RepoSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RepoSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Source. */ + interface ISource { + + /** Source storageSource */ + storageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** Source repoSource */ + repoSource?: (google.cloud.functions.v2.IRepoSource|null); + } + + /** Represents a Source. */ + class Source implements ISource { + + /** + * Constructs a new Source. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ISource); + + /** Source storageSource. */ + public storageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** Source repoSource. */ + public repoSource?: (google.cloud.functions.v2.IRepoSource|null); + + /** Source source. */ + public source?: ("storageSource"|"repoSource"); + + /** + * Creates a new Source instance using the specified properties. + * @param [properties] Properties to set + * @returns Source instance + */ + public static create(properties?: google.cloud.functions.v2.ISource): google.cloud.functions.v2.Source; + + /** + * Encodes the specified Source message. Does not implicitly {@link google.cloud.functions.v2.Source.verify|verify} messages. + * @param message Source message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ISource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Source message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Source.verify|verify} messages. + * @param message Source message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ISource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Source message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.Source; + + /** + * Decodes a Source message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.Source; + + /** + * Verifies a Source message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Source message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Source + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.Source; + + /** + * Creates a plain object from a Source message. Also converts values to other types if specified. + * @param message Source + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.Source, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Source to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SourceProvenance. */ + interface ISourceProvenance { + + /** SourceProvenance resolvedStorageSource */ + resolvedStorageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** SourceProvenance resolvedRepoSource */ + resolvedRepoSource?: (google.cloud.functions.v2.IRepoSource|null); + } + + /** Represents a SourceProvenance. */ + class SourceProvenance implements ISourceProvenance { + + /** + * Constructs a new SourceProvenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ISourceProvenance); + + /** SourceProvenance resolvedStorageSource. */ + public resolvedStorageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** SourceProvenance resolvedRepoSource. */ + public resolvedRepoSource?: (google.cloud.functions.v2.IRepoSource|null); + + /** + * Creates a new SourceProvenance instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceProvenance instance + */ + public static create(properties?: google.cloud.functions.v2.ISourceProvenance): google.cloud.functions.v2.SourceProvenance; + + /** + * Encodes the specified SourceProvenance message. Does not implicitly {@link google.cloud.functions.v2.SourceProvenance.verify|verify} messages. + * @param message SourceProvenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ISourceProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceProvenance message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SourceProvenance.verify|verify} messages. + * @param message SourceProvenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ISourceProvenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.SourceProvenance; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.SourceProvenance; + + /** + * Verifies a SourceProvenance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceProvenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceProvenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.SourceProvenance; + + /** + * Creates a plain object from a SourceProvenance message. Also converts values to other types if specified. + * @param message SourceProvenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.SourceProvenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceProvenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BuildConfig. */ + interface IBuildConfig { + + /** BuildConfig build */ + build?: (string|null); + + /** BuildConfig runtime */ + runtime?: (string|null); + + /** BuildConfig entryPoint */ + entryPoint?: (string|null); + + /** BuildConfig source */ + source?: (google.cloud.functions.v2.ISource|null); + + /** BuildConfig sourceProvenance */ + sourceProvenance?: (google.cloud.functions.v2.ISourceProvenance|null); + + /** BuildConfig workerPool */ + workerPool?: (string|null); + + /** BuildConfig environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** BuildConfig dockerRepository */ + dockerRepository?: (string|null); + } + + /** Represents a BuildConfig. */ + class BuildConfig implements IBuildConfig { + + /** + * Constructs a new BuildConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IBuildConfig); + + /** BuildConfig build. */ + public build: string; + + /** BuildConfig runtime. */ + public runtime: string; + + /** BuildConfig entryPoint. */ + public entryPoint: string; + + /** BuildConfig source. */ + public source?: (google.cloud.functions.v2.ISource|null); + + /** BuildConfig sourceProvenance. */ + public sourceProvenance?: (google.cloud.functions.v2.ISourceProvenance|null); + + /** BuildConfig workerPool. */ + public workerPool: string; + + /** BuildConfig environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** BuildConfig dockerRepository. */ + public dockerRepository: string; + + /** + * Creates a new BuildConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BuildConfig instance + */ + public static create(properties?: google.cloud.functions.v2.IBuildConfig): google.cloud.functions.v2.BuildConfig; + + /** + * Encodes the specified BuildConfig message. Does not implicitly {@link google.cloud.functions.v2.BuildConfig.verify|verify} messages. + * @param message BuildConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IBuildConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BuildConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2.BuildConfig.verify|verify} messages. + * @param message BuildConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IBuildConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BuildConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.BuildConfig; + + /** + * Decodes a BuildConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.BuildConfig; + + /** + * Verifies a BuildConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BuildConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BuildConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.BuildConfig; + + /** + * Creates a plain object from a BuildConfig message. Also converts values to other types if specified. + * @param message BuildConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.BuildConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BuildConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceConfig. */ + interface IServiceConfig { + + /** ServiceConfig service */ + service?: (string|null); + + /** ServiceConfig timeoutSeconds */ + timeoutSeconds?: (number|null); + + /** ServiceConfig availableMemory */ + availableMemory?: (string|null); + + /** ServiceConfig environmentVariables */ + environmentVariables?: ({ [k: string]: string }|null); + + /** ServiceConfig maxInstanceCount */ + maxInstanceCount?: (number|null); + + /** ServiceConfig minInstanceCount */ + minInstanceCount?: (number|null); + + /** ServiceConfig vpcConnector */ + vpcConnector?: (string|null); + + /** ServiceConfig vpcConnectorEgressSettings */ + vpcConnectorEgressSettings?: (google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings|null); + + /** ServiceConfig ingressSettings */ + ingressSettings?: (google.cloud.functions.v2.ServiceConfig.IngressSettings|keyof typeof google.cloud.functions.v2.ServiceConfig.IngressSettings|null); + + /** ServiceConfig uri */ + uri?: (string|null); + + /** ServiceConfig serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** ServiceConfig allTrafficOnLatestRevision */ + allTrafficOnLatestRevision?: (boolean|null); + + /** ServiceConfig secretEnvironmentVariables */ + secretEnvironmentVariables?: (google.cloud.functions.v2.ISecretEnvVar[]|null); + + /** ServiceConfig secretVolumes */ + secretVolumes?: (google.cloud.functions.v2.ISecretVolume[]|null); + + /** ServiceConfig revision */ + revision?: (string|null); + } + + /** Represents a ServiceConfig. */ + class ServiceConfig implements IServiceConfig { + + /** + * Constructs a new ServiceConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IServiceConfig); + + /** ServiceConfig service. */ + public service: string; + + /** ServiceConfig timeoutSeconds. */ + public timeoutSeconds: number; + + /** ServiceConfig availableMemory. */ + public availableMemory: string; + + /** ServiceConfig environmentVariables. */ + public environmentVariables: { [k: string]: string }; + + /** ServiceConfig maxInstanceCount. */ + public maxInstanceCount: number; + + /** ServiceConfig minInstanceCount. */ + public minInstanceCount: number; + + /** ServiceConfig vpcConnector. */ + public vpcConnector: string; + + /** ServiceConfig vpcConnectorEgressSettings. */ + public vpcConnectorEgressSettings: (google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings|keyof typeof google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings); + + /** ServiceConfig ingressSettings. */ + public ingressSettings: (google.cloud.functions.v2.ServiceConfig.IngressSettings|keyof typeof google.cloud.functions.v2.ServiceConfig.IngressSettings); + + /** ServiceConfig uri. */ + public uri: string; + + /** ServiceConfig serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** ServiceConfig allTrafficOnLatestRevision. */ + public allTrafficOnLatestRevision: boolean; + + /** ServiceConfig secretEnvironmentVariables. */ + public secretEnvironmentVariables: google.cloud.functions.v2.ISecretEnvVar[]; + + /** ServiceConfig secretVolumes. */ + public secretVolumes: google.cloud.functions.v2.ISecretVolume[]; + + /** ServiceConfig revision. */ + public revision: string; + + /** + * Creates a new ServiceConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceConfig instance + */ + public static create(properties?: google.cloud.functions.v2.IServiceConfig): google.cloud.functions.v2.ServiceConfig; + + /** + * Encodes the specified ServiceConfig message. Does not implicitly {@link google.cloud.functions.v2.ServiceConfig.verify|verify} messages. + * @param message ServiceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IServiceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ServiceConfig.verify|verify} messages. + * @param message ServiceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IServiceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.ServiceConfig; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.ServiceConfig; + + /** + * Verifies a ServiceConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ServiceConfig; + + /** + * Creates a plain object from a ServiceConfig message. Also converts values to other types if specified. + * @param message ServiceConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ServiceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ServiceConfig { + + /** VpcConnectorEgressSettings enum. */ + enum VpcConnectorEgressSettings { + VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0, + PRIVATE_RANGES_ONLY = 1, + ALL_TRAFFIC = 2 + } + + /** IngressSettings enum. */ + enum IngressSettings { + INGRESS_SETTINGS_UNSPECIFIED = 0, + ALLOW_ALL = 1, + ALLOW_INTERNAL_ONLY = 2, + ALLOW_INTERNAL_AND_GCLB = 3 + } + } + + /** Properties of a SecretEnvVar. */ + interface ISecretEnvVar { + + /** SecretEnvVar key */ + key?: (string|null); + + /** SecretEnvVar projectId */ + projectId?: (string|null); + + /** SecretEnvVar secret */ + secret?: (string|null); + + /** SecretEnvVar version */ + version?: (string|null); + } + + /** Represents a SecretEnvVar. */ + class SecretEnvVar implements ISecretEnvVar { + + /** + * Constructs a new SecretEnvVar. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ISecretEnvVar); + + /** SecretEnvVar key. */ + public key: string; + + /** SecretEnvVar projectId. */ + public projectId: string; + + /** SecretEnvVar secret. */ + public secret: string; + + /** SecretEnvVar version. */ + public version: string; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretEnvVar instance + */ + public static create(properties?: google.cloud.functions.v2.ISecretEnvVar): google.cloud.functions.v2.SecretEnvVar; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v2.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretEnvVar.verify|verify} messages. + * @param message SecretEnvVar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ISecretEnvVar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.SecretEnvVar; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.SecretEnvVar; + + /** + * Verifies a SecretEnvVar message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretEnvVar + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.SecretEnvVar; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @param message SecretEnvVar + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.SecretEnvVar, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretEnvVar to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SecretVolume. */ + interface ISecretVolume { + + /** SecretVolume mountPath */ + mountPath?: (string|null); + + /** SecretVolume projectId */ + projectId?: (string|null); + + /** SecretVolume secret */ + secret?: (string|null); + + /** SecretVolume versions */ + versions?: (google.cloud.functions.v2.SecretVolume.ISecretVersion[]|null); + } + + /** Represents a SecretVolume. */ + class SecretVolume implements ISecretVolume { + + /** + * Constructs a new SecretVolume. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ISecretVolume); + + /** SecretVolume mountPath. */ + public mountPath: string; + + /** SecretVolume projectId. */ + public projectId: string; + + /** SecretVolume secret. */ + public secret: string; + + /** SecretVolume versions. */ + public versions: google.cloud.functions.v2.SecretVolume.ISecretVersion[]; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVolume instance + */ + public static create(properties?: google.cloud.functions.v2.ISecretVolume): google.cloud.functions.v2.SecretVolume; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.verify|verify} messages. + * @param message SecretVolume message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ISecretVolume, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.SecretVolume; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.SecretVolume; + + /** + * Verifies a SecretVolume message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVolume + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.SecretVolume; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @param message SecretVolume + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.SecretVolume, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVolume to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SecretVolume { + + /** Properties of a SecretVersion. */ + interface ISecretVersion { + + /** SecretVersion version */ + version?: (string|null); + + /** SecretVersion path */ + path?: (string|null); + } + + /** Represents a SecretVersion. */ + class SecretVersion implements ISecretVersion { + + /** + * Constructs a new SecretVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.SecretVolume.ISecretVersion); + + /** SecretVersion version. */ + public version: string; + + /** SecretVersion path. */ + public path: string; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns SecretVersion instance + */ + public static create(properties?: google.cloud.functions.v2.SecretVolume.ISecretVersion): google.cloud.functions.v2.SecretVolume.SecretVersion; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.SecretVersion.verify|verify} messages. + * @param message SecretVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.SecretVolume.ISecretVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.SecretVolume.SecretVersion; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.SecretVolume.SecretVersion; + + /** + * Verifies a SecretVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecretVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.SecretVolume.SecretVersion; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @param message SecretVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.SecretVolume.SecretVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecretVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EventTrigger. */ + interface IEventTrigger { + + /** EventTrigger trigger */ + trigger?: (string|null); + + /** EventTrigger triggerRegion */ + triggerRegion?: (string|null); + + /** EventTrigger eventType */ + eventType?: (string|null); + + /** EventTrigger eventFilters */ + eventFilters?: (google.cloud.functions.v2.IEventFilter[]|null); + + /** EventTrigger pubsubTopic */ + pubsubTopic?: (string|null); + + /** EventTrigger serviceAccountEmail */ + serviceAccountEmail?: (string|null); + + /** EventTrigger retryPolicy */ + retryPolicy?: (google.cloud.functions.v2.EventTrigger.RetryPolicy|keyof typeof google.cloud.functions.v2.EventTrigger.RetryPolicy|null); + + /** EventTrigger channel */ + channel?: (string|null); + } + + /** Represents an EventTrigger. */ + class EventTrigger implements IEventTrigger { + + /** + * Constructs a new EventTrigger. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IEventTrigger); + + /** EventTrigger trigger. */ + public trigger: string; + + /** EventTrigger triggerRegion. */ + public triggerRegion: string; + + /** EventTrigger eventType. */ + public eventType: string; + + /** EventTrigger eventFilters. */ + public eventFilters: google.cloud.functions.v2.IEventFilter[]; + + /** EventTrigger pubsubTopic. */ + public pubsubTopic: string; + + /** EventTrigger serviceAccountEmail. */ + public serviceAccountEmail: string; + + /** EventTrigger retryPolicy. */ + public retryPolicy: (google.cloud.functions.v2.EventTrigger.RetryPolicy|keyof typeof google.cloud.functions.v2.EventTrigger.RetryPolicy); + + /** EventTrigger channel. */ + public channel: string; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @param [properties] Properties to set + * @returns EventTrigger instance + */ + public static create(properties?: google.cloud.functions.v2.IEventTrigger): google.cloud.functions.v2.EventTrigger; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v2.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v2.EventTrigger.verify|verify} messages. + * @param message EventTrigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IEventTrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.EventTrigger; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.EventTrigger; + + /** + * Verifies an EventTrigger message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventTrigger + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.EventTrigger; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @param message EventTrigger + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.EventTrigger, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventTrigger to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EventTrigger { + + /** RetryPolicy enum. */ + enum RetryPolicy { + RETRY_POLICY_UNSPECIFIED = 0, + RETRY_POLICY_DO_NOT_RETRY = 1, + RETRY_POLICY_RETRY = 2 + } + } + + /** Properties of an EventFilter. */ + interface IEventFilter { + + /** EventFilter attribute */ + attribute?: (string|null); + + /** EventFilter value */ + value?: (string|null); + + /** EventFilter operator */ + operator?: (string|null); + } + + /** Represents an EventFilter. */ + class EventFilter implements IEventFilter { + + /** + * Constructs a new EventFilter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IEventFilter); + + /** EventFilter attribute. */ + public attribute: string; + + /** EventFilter value. */ + public value: string; + + /** EventFilter operator. */ + public operator: string; + + /** + * Creates a new EventFilter instance using the specified properties. + * @param [properties] Properties to set + * @returns EventFilter instance + */ + public static create(properties?: google.cloud.functions.v2.IEventFilter): google.cloud.functions.v2.EventFilter; + + /** + * Encodes the specified EventFilter message. Does not implicitly {@link google.cloud.functions.v2.EventFilter.verify|verify} messages. + * @param message EventFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IEventFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventFilter message, length delimited. Does not implicitly {@link google.cloud.functions.v2.EventFilter.verify|verify} messages. + * @param message EventFilter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IEventFilter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventFilter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.EventFilter; + + /** + * Decodes an EventFilter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.EventFilter; + + /** + * Verifies an EventFilter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EventFilter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventFilter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.EventFilter; + + /** + * Creates a plain object from an EventFilter message. Also converts values to other types if specified. + * @param message EventFilter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.EventFilter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventFilter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetFunctionRequest. */ + interface IGetFunctionRequest { + + /** GetFunctionRequest name */ + name?: (string|null); + } + + /** Represents a GetFunctionRequest. */ + class GetFunctionRequest implements IGetFunctionRequest { + + /** + * Constructs a new GetFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGetFunctionRequest); + + /** GetFunctionRequest name. */ + public name: string; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IGetFunctionRequest): google.cloud.functions.v2.GetFunctionRequest; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GetFunctionRequest.verify|verify} messages. + * @param message GetFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGetFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.GetFunctionRequest; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.GetFunctionRequest; + + /** + * Verifies a GetFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GetFunctionRequest; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @param message GetFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GetFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsRequest. */ + interface IListFunctionsRequest { + + /** ListFunctionsRequest parent */ + parent?: (string|null); + + /** ListFunctionsRequest pageSize */ + pageSize?: (number|null); + + /** ListFunctionsRequest pageToken */ + pageToken?: (string|null); + + /** ListFunctionsRequest filter */ + filter?: (string|null); + + /** ListFunctionsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListFunctionsRequest. */ + class ListFunctionsRequest implements IListFunctionsRequest { + + /** + * Constructs a new ListFunctionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IListFunctionsRequest); + + /** ListFunctionsRequest parent. */ + public parent: string; + + /** ListFunctionsRequest pageSize. */ + public pageSize: number; + + /** ListFunctionsRequest pageToken. */ + public pageToken: string; + + /** ListFunctionsRequest filter. */ + public filter: string; + + /** ListFunctionsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IListFunctionsRequest): google.cloud.functions.v2.ListFunctionsRequest; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsRequest.verify|verify} messages. + * @param message ListFunctionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IListFunctionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.ListFunctionsRequest; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.ListFunctionsRequest; + + /** + * Verifies a ListFunctionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListFunctionsRequest; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @param message ListFunctionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListFunctionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFunctionsResponse. */ + interface IListFunctionsResponse { + + /** ListFunctionsResponse functions */ + functions?: (google.cloud.functions.v2.IFunction[]|null); + + /** ListFunctionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListFunctionsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListFunctionsResponse. */ + class ListFunctionsResponse implements IListFunctionsResponse { + + /** + * Constructs a new ListFunctionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IListFunctionsResponse); + + /** ListFunctionsResponse functions. */ + public functions: google.cloud.functions.v2.IFunction[]; + + /** ListFunctionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListFunctionsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFunctionsResponse instance + */ + public static create(properties?: google.cloud.functions.v2.IListFunctionsResponse): google.cloud.functions.v2.ListFunctionsResponse; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsResponse.verify|verify} messages. + * @param message ListFunctionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IListFunctionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.ListFunctionsResponse; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.ListFunctionsResponse; + + /** + * Verifies a ListFunctionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFunctionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListFunctionsResponse; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @param message ListFunctionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListFunctionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateFunctionRequest. */ + interface ICreateFunctionRequest { + + /** CreateFunctionRequest parent */ + parent?: (string|null); + + /** CreateFunctionRequest function */ + "function"?: (google.cloud.functions.v2.IFunction|null); + + /** CreateFunctionRequest functionId */ + functionId?: (string|null); + } + + /** Represents a CreateFunctionRequest. */ + class CreateFunctionRequest implements ICreateFunctionRequest { + + /** + * Constructs a new CreateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ICreateFunctionRequest); + + /** CreateFunctionRequest parent. */ + public parent: string; + + /** CreateFunctionRequest function. */ + public function?: (google.cloud.functions.v2.IFunction|null); + + /** CreateFunctionRequest functionId. */ + public functionId: string; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2.ICreateFunctionRequest): google.cloud.functions.v2.CreateFunctionRequest; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.CreateFunctionRequest.verify|verify} messages. + * @param message CreateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ICreateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.CreateFunctionRequest; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.CreateFunctionRequest; + + /** + * Verifies a CreateFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.CreateFunctionRequest; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @param message CreateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.CreateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateFunctionRequest. */ + interface IUpdateFunctionRequest { + + /** UpdateFunctionRequest function */ + "function"?: (google.cloud.functions.v2.IFunction|null); + + /** UpdateFunctionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateFunctionRequest. */ + class UpdateFunctionRequest implements IUpdateFunctionRequest { + + /** + * Constructs a new UpdateFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IUpdateFunctionRequest); + + /** UpdateFunctionRequest function. */ + public function?: (google.cloud.functions.v2.IFunction|null); + + /** UpdateFunctionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IUpdateFunctionRequest): google.cloud.functions.v2.UpdateFunctionRequest; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.UpdateFunctionRequest.verify|verify} messages. + * @param message UpdateFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IUpdateFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.UpdateFunctionRequest; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.UpdateFunctionRequest; + + /** + * Verifies an UpdateFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.UpdateFunctionRequest; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @param message UpdateFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.UpdateFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteFunctionRequest. */ + interface IDeleteFunctionRequest { + + /** DeleteFunctionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteFunctionRequest. */ + class DeleteFunctionRequest implements IDeleteFunctionRequest { + + /** + * Constructs a new DeleteFunctionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IDeleteFunctionRequest); + + /** DeleteFunctionRequest name. */ + public name: string; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteFunctionRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IDeleteFunctionRequest): google.cloud.functions.v2.DeleteFunctionRequest; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.DeleteFunctionRequest.verify|verify} messages. + * @param message DeleteFunctionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IDeleteFunctionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.DeleteFunctionRequest; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.DeleteFunctionRequest; + + /** + * Verifies a DeleteFunctionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteFunctionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.DeleteFunctionRequest; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @param message DeleteFunctionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.DeleteFunctionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlRequest. */ + interface IGenerateUploadUrlRequest { + + /** GenerateUploadUrlRequest parent */ + parent?: (string|null); + } + + /** Represents a GenerateUploadUrlRequest. */ + class GenerateUploadUrlRequest implements IGenerateUploadUrlRequest { + + /** + * Constructs a new GenerateUploadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGenerateUploadUrlRequest); + + /** GenerateUploadUrlRequest parent. */ + public parent: string; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IGenerateUploadUrlRequest): google.cloud.functions.v2.GenerateUploadUrlRequest; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlRequest.verify|verify} messages. + * @param message GenerateUploadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGenerateUploadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.GenerateUploadUrlRequest; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.GenerateUploadUrlRequest; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GenerateUploadUrlRequest; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateUploadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GenerateUploadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateUploadUrlResponse. */ + interface IGenerateUploadUrlResponse { + + /** GenerateUploadUrlResponse uploadUrl */ + uploadUrl?: (string|null); + + /** GenerateUploadUrlResponse storageSource */ + storageSource?: (google.cloud.functions.v2.IStorageSource|null); + } + + /** Represents a GenerateUploadUrlResponse. */ + class GenerateUploadUrlResponse implements IGenerateUploadUrlResponse { + + /** + * Constructs a new GenerateUploadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGenerateUploadUrlResponse); + + /** GenerateUploadUrlResponse uploadUrl. */ + public uploadUrl: string; + + /** GenerateUploadUrlResponse storageSource. */ + public storageSource?: (google.cloud.functions.v2.IStorageSource|null); + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateUploadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v2.IGenerateUploadUrlResponse): google.cloud.functions.v2.GenerateUploadUrlResponse; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlResponse.verify|verify} messages. + * @param message GenerateUploadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGenerateUploadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.GenerateUploadUrlResponse; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.GenerateUploadUrlResponse; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateUploadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GenerateUploadUrlResponse; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateUploadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GenerateUploadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlRequest. */ + interface IGenerateDownloadUrlRequest { + + /** GenerateDownloadUrlRequest name */ + name?: (string|null); + } + + /** Represents a GenerateDownloadUrlRequest. */ + class GenerateDownloadUrlRequest implements IGenerateDownloadUrlRequest { + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGenerateDownloadUrlRequest); + + /** GenerateDownloadUrlRequest name. */ + public name: string; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IGenerateDownloadUrlRequest): google.cloud.functions.v2.GenerateDownloadUrlRequest; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlRequest.verify|verify} messages. + * @param message GenerateDownloadUrlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGenerateDownloadUrlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.GenerateDownloadUrlRequest; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.GenerateDownloadUrlRequest; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GenerateDownloadUrlRequest; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GenerateDownloadUrlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GenerateDownloadUrlResponse. */ + interface IGenerateDownloadUrlResponse { + + /** GenerateDownloadUrlResponse downloadUrl */ + downloadUrl?: (string|null); + } + + /** Represents a GenerateDownloadUrlResponse. */ + class GenerateDownloadUrlResponse implements IGenerateDownloadUrlResponse { + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IGenerateDownloadUrlResponse); + + /** GenerateDownloadUrlResponse downloadUrl. */ + public downloadUrl: string; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateDownloadUrlResponse instance + */ + public static create(properties?: google.cloud.functions.v2.IGenerateDownloadUrlResponse): google.cloud.functions.v2.GenerateDownloadUrlResponse; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlResponse.verify|verify} messages. + * @param message GenerateDownloadUrlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IGenerateDownloadUrlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.GenerateDownloadUrlResponse; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.GenerateDownloadUrlResponse; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateDownloadUrlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.GenerateDownloadUrlResponse; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @param message GenerateDownloadUrlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.GenerateDownloadUrlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimesRequest. */ + interface IListRuntimesRequest { + + /** ListRuntimesRequest parent */ + parent?: (string|null); + + /** ListRuntimesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListRuntimesRequest. */ + class ListRuntimesRequest implements IListRuntimesRequest { + + /** + * Constructs a new ListRuntimesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IListRuntimesRequest); + + /** ListRuntimesRequest parent. */ + public parent: string; + + /** ListRuntimesRequest filter. */ + public filter: string; + + /** + * Creates a new ListRuntimesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimesRequest instance + */ + public static create(properties?: google.cloud.functions.v2.IListRuntimesRequest): google.cloud.functions.v2.ListRuntimesRequest; + + /** + * Encodes the specified ListRuntimesRequest message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesRequest.verify|verify} messages. + * @param message ListRuntimesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IListRuntimesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimesRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesRequest.verify|verify} messages. + * @param message ListRuntimesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IListRuntimesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.ListRuntimesRequest; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.ListRuntimesRequest; + + /** + * Verifies a ListRuntimesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRuntimesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListRuntimesRequest; + + /** + * Creates a plain object from a ListRuntimesRequest message. Also converts values to other types if specified. + * @param message ListRuntimesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListRuntimesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListRuntimesResponse. */ + interface IListRuntimesResponse { + + /** ListRuntimesResponse runtimes */ + runtimes?: (google.cloud.functions.v2.ListRuntimesResponse.IRuntime[]|null); + } + + /** Represents a ListRuntimesResponse. */ + class ListRuntimesResponse implements IListRuntimesResponse { + + /** + * Constructs a new ListRuntimesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IListRuntimesResponse); + + /** ListRuntimesResponse runtimes. */ + public runtimes: google.cloud.functions.v2.ListRuntimesResponse.IRuntime[]; + + /** + * Creates a new ListRuntimesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRuntimesResponse instance + */ + public static create(properties?: google.cloud.functions.v2.IListRuntimesResponse): google.cloud.functions.v2.ListRuntimesResponse; + + /** + * Encodes the specified ListRuntimesResponse message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.verify|verify} messages. + * @param message ListRuntimesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IListRuntimesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRuntimesResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.verify|verify} messages. + * @param message ListRuntimesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IListRuntimesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.ListRuntimesResponse; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.ListRuntimesResponse; + + /** + * Verifies a ListRuntimesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRuntimesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRuntimesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListRuntimesResponse; + + /** + * Creates a plain object from a ListRuntimesResponse message. Also converts values to other types if specified. + * @param message ListRuntimesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListRuntimesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRuntimesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ListRuntimesResponse { + + /** Properties of a Runtime. */ + interface IRuntime { + + /** Runtime name */ + name?: (string|null); + + /** Runtime displayName */ + displayName?: (string|null); + + /** Runtime stage */ + stage?: (google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage|keyof typeof google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage|null); + + /** Runtime warnings */ + warnings?: (string[]|null); + + /** Runtime environment */ + environment?: (google.cloud.functions.v2.Environment|keyof typeof google.cloud.functions.v2.Environment|null); + } + + /** Represents a Runtime. */ + class Runtime implements IRuntime { + + /** + * Constructs a new Runtime. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.ListRuntimesResponse.IRuntime); + + /** Runtime name. */ + public name: string; + + /** Runtime displayName. */ + public displayName: string; + + /** Runtime stage. */ + public stage: (google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage|keyof typeof google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage); + + /** Runtime warnings. */ + public warnings: string[]; + + /** Runtime environment. */ + public environment: (google.cloud.functions.v2.Environment|keyof typeof google.cloud.functions.v2.Environment); + + /** + * Creates a new Runtime instance using the specified properties. + * @param [properties] Properties to set + * @returns Runtime instance + */ + public static create(properties?: google.cloud.functions.v2.ListRuntimesResponse.IRuntime): google.cloud.functions.v2.ListRuntimesResponse.Runtime; + + /** + * Encodes the specified Runtime message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify|verify} messages. + * @param message Runtime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.ListRuntimesResponse.IRuntime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Runtime message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify|verify} messages. + * @param message Runtime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.ListRuntimesResponse.IRuntime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Runtime message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.ListRuntimesResponse.Runtime; + + /** + * Decodes a Runtime message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.ListRuntimesResponse.Runtime; + + /** + * Verifies a Runtime message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Runtime message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Runtime + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.ListRuntimesResponse.Runtime; + + /** + * Creates a plain object from a Runtime message. Also converts values to other types if specified. + * @param message Runtime + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.ListRuntimesResponse.Runtime, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Runtime to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** RuntimeStage enum. */ + enum RuntimeStage { + RUNTIME_STAGE_UNSPECIFIED = 0, + DEVELOPMENT = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5, + DECOMMISSIONED = 6 + } + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target */ + target?: (string|null); + + /** OperationMetadata verb */ + verb?: (string|null); + + /** OperationMetadata statusDetail */ + statusDetail?: (string|null); + + /** OperationMetadata cancelRequested */ + cancelRequested?: (boolean|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); + + /** OperationMetadata requestResource */ + requestResource?: (google.protobuf.IAny|null); + + /** OperationMetadata stages */ + stages?: (google.cloud.functions.v2.IStage[]|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IOperationMetadata); + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target. */ + public target: string; + + /** OperationMetadata verb. */ + public verb: string; + + /** OperationMetadata statusDetail. */ + public statusDetail: string; + + /** OperationMetadata cancelRequested. */ + public cancelRequested: boolean; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; + + /** OperationMetadata requestResource. */ + public requestResource?: (google.protobuf.IAny|null); + + /** OperationMetadata stages. */ + public stages: google.cloud.functions.v2.IStage[]; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.functions.v2.IOperationMetadata): google.cloud.functions.v2.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.functions.v2.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.functions.v2.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.OperationMetadata; + + /** + * Verifies an OperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Stage. */ + interface IStage { + + /** Stage name */ + name?: (google.cloud.functions.v2.Stage.Name|keyof typeof google.cloud.functions.v2.Stage.Name|null); + + /** Stage message */ + message?: (string|null); + + /** Stage state */ + state?: (google.cloud.functions.v2.Stage.State|keyof typeof google.cloud.functions.v2.Stage.State|null); + + /** Stage resource */ + resource?: (string|null); + + /** Stage resourceUri */ + resourceUri?: (string|null); + + /** Stage stateMessages */ + stateMessages?: (google.cloud.functions.v2.IStateMessage[]|null); + } + + /** Represents a Stage. */ + class Stage implements IStage { + + /** + * Constructs a new Stage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.functions.v2.IStage); + + /** Stage name. */ + public name: (google.cloud.functions.v2.Stage.Name|keyof typeof google.cloud.functions.v2.Stage.Name); + + /** Stage message. */ + public message: string; + + /** Stage state. */ + public state: (google.cloud.functions.v2.Stage.State|keyof typeof google.cloud.functions.v2.Stage.State); + + /** Stage resource. */ + public resource: string; + + /** Stage resourceUri. */ + public resourceUri: string; + + /** Stage stateMessages. */ + public stateMessages: google.cloud.functions.v2.IStateMessage[]; + + /** + * Creates a new Stage instance using the specified properties. + * @param [properties] Properties to set + * @returns Stage instance + */ + public static create(properties?: google.cloud.functions.v2.IStage): google.cloud.functions.v2.Stage; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.cloud.functions.v2.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.functions.v2.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Stage.verify|verify} messages. + * @param message Stage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.functions.v2.IStage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.functions.v2.Stage; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.functions.v2.Stage; + + /** + * Verifies a Stage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Stage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.functions.v2.Stage; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @param message Stage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.functions.v2.Stage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Stage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Stage { + + /** Name enum. */ + enum Name { + NAME_UNSPECIFIED = 0, + ARTIFACT_REGISTRY = 1, + BUILD = 2, + SERVICE = 3, + TRIGGER = 4, + SERVICE_ROLLBACK = 5, + TRIGGER_ROLLBACK = 6 + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + NOT_STARTED = 1, + IN_PROGRESS = 2, + COMPLETE = 3 + } + } + } + /** Namespace v2alpha. */ namespace v2alpha { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 020f622ce89..78d62c3febc 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -6558,6 +6558,8382 @@ return v1; })(); + functions.v2 = (function() { + + /** + * Namespace v2. + * @memberof google.cloud.functions + * @namespace + */ + var v2 = {}; + + v2.FunctionService = (function() { + + /** + * Constructs a new FunctionService service. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a FunctionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function FunctionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (FunctionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = FunctionService; + + /** + * Creates new FunctionService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.functions.v2.FunctionService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {FunctionService} RPC service. Useful where requests and/or responses are streamed. + */ + FunctionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#getFunction}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef GetFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.Function} [response] Function + */ + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.GetFunctionCallback} callback Node-style callback called with the error, if any, and Function + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.getFunction = function getFunction(request, callback) { + return this.rpcCall(getFunction, $root.google.cloud.functions.v2.GetFunctionRequest, $root.google.cloud.functions.v2.Function, request, callback); + }, "name", { value: "GetFunction" }); + + /** + * Calls GetFunction. + * @function getFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGetFunctionRequest} request GetFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#listFunctions}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef ListFunctionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.ListFunctionsResponse} [response] ListFunctionsResponse + */ + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.ListFunctionsCallback} callback Node-style callback called with the error, if any, and ListFunctionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.listFunctions = function listFunctions(request, callback) { + return this.rpcCall(listFunctions, $root.google.cloud.functions.v2.ListFunctionsRequest, $root.google.cloud.functions.v2.ListFunctionsResponse, request, callback); + }, "name", { value: "ListFunctions" }); + + /** + * Calls ListFunctions. + * @function listFunctions + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IListFunctionsRequest} request ListFunctionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#createFunction}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef CreateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.CreateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.createFunction = function createFunction(request, callback) { + return this.rpcCall(createFunction, $root.google.cloud.functions.v2.CreateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateFunction" }); + + /** + * Calls CreateFunction. + * @function createFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.ICreateFunctionRequest} request CreateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#updateFunction}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef UpdateFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.UpdateFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.updateFunction = function updateFunction(request, callback) { + return this.rpcCall(updateFunction, $root.google.cloud.functions.v2.UpdateFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateFunction" }); + + /** + * Calls UpdateFunction. + * @function updateFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IUpdateFunctionRequest} request UpdateFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#deleteFunction}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef DeleteFunctionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.DeleteFunctionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.deleteFunction = function deleteFunction(request, callback) { + return this.rpcCall(deleteFunction, $root.google.cloud.functions.v2.DeleteFunctionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteFunction" }); + + /** + * Calls DeleteFunction. + * @function deleteFunction + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IDeleteFunctionRequest} request DeleteFunctionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateUploadUrl}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef GenerateUploadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.GenerateUploadUrlResponse} [response] GenerateUploadUrlResponse + */ + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.GenerateUploadUrlCallback} callback Node-style callback called with the error, if any, and GenerateUploadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.generateUploadUrl = function generateUploadUrl(request, callback) { + return this.rpcCall(generateUploadUrl, $root.google.cloud.functions.v2.GenerateUploadUrlRequest, $root.google.cloud.functions.v2.GenerateUploadUrlResponse, request, callback); + }, "name", { value: "GenerateUploadUrl" }); + + /** + * Calls GenerateUploadUrl. + * @function generateUploadUrl + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest} request GenerateUploadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateDownloadUrl}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef GenerateDownloadUrlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.GenerateDownloadUrlResponse} [response] GenerateDownloadUrlResponse + */ + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.GenerateDownloadUrlCallback} callback Node-style callback called with the error, if any, and GenerateDownloadUrlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.generateDownloadUrl = function generateDownloadUrl(request, callback) { + return this.rpcCall(generateDownloadUrl, $root.google.cloud.functions.v2.GenerateDownloadUrlRequest, $root.google.cloud.functions.v2.GenerateDownloadUrlResponse, request, callback); + }, "name", { value: "GenerateDownloadUrl" }); + + /** + * Calls GenerateDownloadUrl. + * @function generateDownloadUrl + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest} request GenerateDownloadUrlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.functions.v2.FunctionService#listRuntimes}. + * @memberof google.cloud.functions.v2.FunctionService + * @typedef ListRuntimesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.functions.v2.ListRuntimesResponse} [response] ListRuntimesResponse + */ + + /** + * Calls ListRuntimes. + * @function listRuntimes + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IListRuntimesRequest} request ListRuntimesRequest message or plain object + * @param {google.cloud.functions.v2.FunctionService.ListRuntimesCallback} callback Node-style callback called with the error, if any, and ListRuntimesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(FunctionService.prototype.listRuntimes = function listRuntimes(request, callback) { + return this.rpcCall(listRuntimes, $root.google.cloud.functions.v2.ListRuntimesRequest, $root.google.cloud.functions.v2.ListRuntimesResponse, request, callback); + }, "name", { value: "ListRuntimes" }); + + /** + * Calls ListRuntimes. + * @function listRuntimes + * @memberof google.cloud.functions.v2.FunctionService + * @instance + * @param {google.cloud.functions.v2.IListRuntimesRequest} request ListRuntimesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return FunctionService; + })(); + + /** + * Environment enum. + * @name google.cloud.functions.v2.Environment + * @enum {number} + * @property {number} ENVIRONMENT_UNSPECIFIED=0 ENVIRONMENT_UNSPECIFIED value + * @property {number} GEN_1=1 GEN_1 value + * @property {number} GEN_2=2 GEN_2 value + */ + v2.Environment = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENVIRONMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "GEN_1"] = 1; + values[valuesById[2] = "GEN_2"] = 2; + return values; + })(); + + v2.Function = (function() { + + /** + * Properties of a Function. + * @memberof google.cloud.functions.v2 + * @interface IFunction + * @property {string|null} [name] Function name + * @property {google.cloud.functions.v2.Environment|null} [environment] Function environment + * @property {string|null} [description] Function description + * @property {google.cloud.functions.v2.IBuildConfig|null} [buildConfig] Function buildConfig + * @property {google.cloud.functions.v2.IServiceConfig|null} [serviceConfig] Function serviceConfig + * @property {google.cloud.functions.v2.IEventTrigger|null} [eventTrigger] Function eventTrigger + * @property {google.cloud.functions.v2.Function.State|null} [state] Function state + * @property {google.protobuf.ITimestamp|null} [updateTime] Function updateTime + * @property {Object.|null} [labels] Function labels + * @property {Array.|null} [stateMessages] Function stateMessages + */ + + /** + * Constructs a new Function. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a Function. + * @implements IFunction + * @constructor + * @param {google.cloud.functions.v2.IFunction=} [properties] Properties to set + */ + function Function(properties) { + this.labels = {}; + this.stateMessages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Function name. + * @member {string} name + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.name = ""; + + /** + * Function environment. + * @member {google.cloud.functions.v2.Environment} environment + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.environment = 0; + + /** + * Function description. + * @member {string} description + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.description = ""; + + /** + * Function buildConfig. + * @member {google.cloud.functions.v2.IBuildConfig|null|undefined} buildConfig + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.buildConfig = null; + + /** + * Function serviceConfig. + * @member {google.cloud.functions.v2.IServiceConfig|null|undefined} serviceConfig + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.serviceConfig = null; + + /** + * Function eventTrigger. + * @member {google.cloud.functions.v2.IEventTrigger|null|undefined} eventTrigger + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.eventTrigger = null; + + /** + * Function state. + * @member {google.cloud.functions.v2.Function.State} state + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.state = 0; + + /** + * Function updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.updateTime = null; + + /** + * Function labels. + * @member {Object.} labels + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.labels = $util.emptyObject; + + /** + * Function stateMessages. + * @member {Array.} stateMessages + * @memberof google.cloud.functions.v2.Function + * @instance + */ + Function.prototype.stateMessages = $util.emptyArray; + + /** + * Creates a new Function instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.Function + * @static + * @param {google.cloud.functions.v2.IFunction=} [properties] Properties to set + * @returns {google.cloud.functions.v2.Function} Function instance + */ + Function.create = function create(properties) { + return new Function(properties); + }; + + /** + * Encodes the specified Function message. Does not implicitly {@link google.cloud.functions.v2.Function.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.Function + * @static + * @param {google.cloud.functions.v2.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.buildConfig != null && Object.hasOwnProperty.call(message, "buildConfig")) + $root.google.cloud.functions.v2.BuildConfig.encode(message.buildConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.serviceConfig != null && Object.hasOwnProperty.call(message, "serviceConfig")) + $root.google.cloud.functions.v2.ServiceConfig.encode(message.serviceConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.eventTrigger != null && Object.hasOwnProperty.call(message, "eventTrigger")) + $root.google.cloud.functions.v2.EventTrigger.encode(message.eventTrigger, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.stateMessages != null && message.stateMessages.length) + for (var i = 0; i < message.stateMessages.length; ++i) + $root.google.cloud.functions.v2.StateMessage.encode(message.stateMessages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.environment); + return writer; + }; + + /** + * Encodes the specified Function message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Function.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.Function + * @static + * @param {google.cloud.functions.v2.IFunction} message Function message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Function.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Function message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.Function(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 10: + message.environment = reader.int32(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.buildConfig = $root.google.cloud.functions.v2.BuildConfig.decode(reader, reader.uint32()); + break; + case 4: + message.serviceConfig = $root.google.cloud.functions.v2.ServiceConfig.decode(reader, reader.uint32()); + break; + case 5: + message.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.decode(reader, reader.uint32()); + break; + case 6: + message.state = reader.int32(); + break; + case 7: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 8: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 9: + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2.StateMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Function message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.Function + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.Function} Function + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Function.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Function message. + * @function verify + * @memberof google.cloud.functions.v2.Function + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Function.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.environment != null && message.hasOwnProperty("environment")) + switch (message.environment) { + default: + return "environment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.buildConfig != null && message.hasOwnProperty("buildConfig")) { + var error = $root.google.cloud.functions.v2.BuildConfig.verify(message.buildConfig); + if (error) + return "buildConfig." + error; + } + if (message.serviceConfig != null && message.hasOwnProperty("serviceConfig")) { + var error = $root.google.cloud.functions.v2.ServiceConfig.verify(message.serviceConfig); + if (error) + return "serviceConfig." + error; + } + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) { + var error = $root.google.cloud.functions.v2.EventTrigger.verify(message.eventTrigger); + if (error) + return "eventTrigger." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.stateMessages != null && message.hasOwnProperty("stateMessages")) { + if (!Array.isArray(message.stateMessages)) + return "stateMessages: array expected"; + for (var i = 0; i < message.stateMessages.length; ++i) { + var error = $root.google.cloud.functions.v2.StateMessage.verify(message.stateMessages[i]); + if (error) + return "stateMessages." + error; + } + } + return null; + }; + + /** + * Creates a Function message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.Function + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.Function} Function + */ + Function.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.Function) + return object; + var message = new $root.google.cloud.functions.v2.Function(); + if (object.name != null) + message.name = String(object.name); + switch (object.environment) { + case "ENVIRONMENT_UNSPECIFIED": + case 0: + message.environment = 0; + break; + case "GEN_1": + case 1: + message.environment = 1; + break; + case "GEN_2": + case 2: + message.environment = 2; + break; + } + if (object.description != null) + message.description = String(object.description); + if (object.buildConfig != null) { + if (typeof object.buildConfig !== "object") + throw TypeError(".google.cloud.functions.v2.Function.buildConfig: object expected"); + message.buildConfig = $root.google.cloud.functions.v2.BuildConfig.fromObject(object.buildConfig); + } + if (object.serviceConfig != null) { + if (typeof object.serviceConfig !== "object") + throw TypeError(".google.cloud.functions.v2.Function.serviceConfig: object expected"); + message.serviceConfig = $root.google.cloud.functions.v2.ServiceConfig.fromObject(object.serviceConfig); + } + if (object.eventTrigger != null) { + if (typeof object.eventTrigger !== "object") + throw TypeError(".google.cloud.functions.v2.Function.eventTrigger: object expected"); + message.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.fromObject(object.eventTrigger); + } + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACTIVE": + case 1: + message.state = 1; + break; + case "FAILED": + case 2: + message.state = 2; + break; + case "DEPLOYING": + case 3: + message.state = 3; + break; + case "DELETING": + case 4: + message.state = 4; + break; + case "UNKNOWN": + case 5: + message.state = 5; + break; + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.functions.v2.Function.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.functions.v2.Function.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.stateMessages) { + if (!Array.isArray(object.stateMessages)) + throw TypeError(".google.cloud.functions.v2.Function.stateMessages: array expected"); + message.stateMessages = []; + for (var i = 0; i < object.stateMessages.length; ++i) { + if (typeof object.stateMessages[i] !== "object") + throw TypeError(".google.cloud.functions.v2.Function.stateMessages: object expected"); + message.stateMessages[i] = $root.google.cloud.functions.v2.StateMessage.fromObject(object.stateMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Function message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.Function + * @static + * @param {google.cloud.functions.v2.Function} message Function + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Function.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stateMessages = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.buildConfig = null; + object.serviceConfig = null; + object.eventTrigger = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.updateTime = null; + object.environment = options.enums === String ? "ENVIRONMENT_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.buildConfig != null && message.hasOwnProperty("buildConfig")) + object.buildConfig = $root.google.cloud.functions.v2.BuildConfig.toObject(message.buildConfig, options); + if (message.serviceConfig != null && message.hasOwnProperty("serviceConfig")) + object.serviceConfig = $root.google.cloud.functions.v2.ServiceConfig.toObject(message.serviceConfig, options); + if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) + object.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.toObject(message.eventTrigger, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.functions.v2.Function.State[message.state] : message.state; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.stateMessages && message.stateMessages.length) { + object.stateMessages = []; + for (var j = 0; j < message.stateMessages.length; ++j) + object.stateMessages[j] = $root.google.cloud.functions.v2.StateMessage.toObject(message.stateMessages[j], options); + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = options.enums === String ? $root.google.cloud.functions.v2.Environment[message.environment] : message.environment; + return object; + }; + + /** + * Converts this Function to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.Function + * @instance + * @returns {Object.} JSON object + */ + Function.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.functions.v2.Function.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} FAILED=2 FAILED value + * @property {number} DEPLOYING=3 DEPLOYING value + * @property {number} DELETING=4 DELETING value + * @property {number} UNKNOWN=5 UNKNOWN value + */ + Function.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "FAILED"] = 2; + values[valuesById[3] = "DEPLOYING"] = 3; + values[valuesById[4] = "DELETING"] = 4; + values[valuesById[5] = "UNKNOWN"] = 5; + return values; + })(); + + return Function; + })(); + + v2.StateMessage = (function() { + + /** + * Properties of a StateMessage. + * @memberof google.cloud.functions.v2 + * @interface IStateMessage + * @property {google.cloud.functions.v2.StateMessage.Severity|null} [severity] StateMessage severity + * @property {string|null} [type] StateMessage type + * @property {string|null} [message] StateMessage message + */ + + /** + * Constructs a new StateMessage. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a StateMessage. + * @implements IStateMessage + * @constructor + * @param {google.cloud.functions.v2.IStateMessage=} [properties] Properties to set + */ + function StateMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StateMessage severity. + * @member {google.cloud.functions.v2.StateMessage.Severity} severity + * @memberof google.cloud.functions.v2.StateMessage + * @instance + */ + StateMessage.prototype.severity = 0; + + /** + * StateMessage type. + * @member {string} type + * @memberof google.cloud.functions.v2.StateMessage + * @instance + */ + StateMessage.prototype.type = ""; + + /** + * StateMessage message. + * @member {string} message + * @memberof google.cloud.functions.v2.StateMessage + * @instance + */ + StateMessage.prototype.message = ""; + + /** + * Creates a new StateMessage instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {google.cloud.functions.v2.IStateMessage=} [properties] Properties to set + * @returns {google.cloud.functions.v2.StateMessage} StateMessage instance + */ + StateMessage.create = function create(properties) { + return new StateMessage(properties); + }; + + /** + * Encodes the specified StateMessage message. Does not implicitly {@link google.cloud.functions.v2.StateMessage.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {google.cloud.functions.v2.IStateMessage} message StateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.severity); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified StateMessage message, length delimited. Does not implicitly {@link google.cloud.functions.v2.StateMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {google.cloud.functions.v2.IStateMessage} message StateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StateMessage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.StateMessage} StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.StateMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.severity = reader.int32(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StateMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.StateMessage} StateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StateMessage message. + * @function verify + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StateMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.severity != null && message.hasOwnProperty("severity")) + switch (message.severity) { + default: + return "severity: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a StateMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.StateMessage} StateMessage + */ + StateMessage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.StateMessage) + return object; + var message = new $root.google.cloud.functions.v2.StateMessage(); + switch (object.severity) { + case "SEVERITY_UNSPECIFIED": + case 0: + message.severity = 0; + break; + case "ERROR": + case 1: + message.severity = 1; + break; + case "WARNING": + case 2: + message.severity = 2; + break; + case "INFO": + case 3: + message.severity = 3; + break; + } + if (object.type != null) + message.type = String(object.type); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a StateMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {google.cloud.functions.v2.StateMessage} message StateMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StateMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.severity = options.enums === String ? "SEVERITY_UNSPECIFIED" : 0; + object.type = ""; + object.message = ""; + } + if (message.severity != null && message.hasOwnProperty("severity")) + object.severity = options.enums === String ? $root.google.cloud.functions.v2.StateMessage.Severity[message.severity] : message.severity; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this StateMessage to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.StateMessage + * @instance + * @returns {Object.} JSON object + */ + StateMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Severity enum. + * @name google.cloud.functions.v2.StateMessage.Severity + * @enum {number} + * @property {number} SEVERITY_UNSPECIFIED=0 SEVERITY_UNSPECIFIED value + * @property {number} ERROR=1 ERROR value + * @property {number} WARNING=2 WARNING value + * @property {number} INFO=3 INFO value + */ + StateMessage.Severity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEVERITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ERROR"] = 1; + values[valuesById[2] = "WARNING"] = 2; + values[valuesById[3] = "INFO"] = 3; + return values; + })(); + + return StateMessage; + })(); + + v2.StorageSource = (function() { + + /** + * Properties of a StorageSource. + * @memberof google.cloud.functions.v2 + * @interface IStorageSource + * @property {string|null} [bucket] StorageSource bucket + * @property {string|null} [object] StorageSource object + * @property {number|Long|null} [generation] StorageSource generation + */ + + /** + * Constructs a new StorageSource. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a StorageSource. + * @implements IStorageSource + * @constructor + * @param {google.cloud.functions.v2.IStorageSource=} [properties] Properties to set + */ + function StorageSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StorageSource bucket. + * @member {string} bucket + * @memberof google.cloud.functions.v2.StorageSource + * @instance + */ + StorageSource.prototype.bucket = ""; + + /** + * StorageSource object. + * @member {string} object + * @memberof google.cloud.functions.v2.StorageSource + * @instance + */ + StorageSource.prototype.object = ""; + + /** + * StorageSource generation. + * @member {number|Long} generation + * @memberof google.cloud.functions.v2.StorageSource + * @instance + */ + StorageSource.prototype.generation = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new StorageSource instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {google.cloud.functions.v2.IStorageSource=} [properties] Properties to set + * @returns {google.cloud.functions.v2.StorageSource} StorageSource instance + */ + StorageSource.create = function create(properties) { + return new StorageSource(properties); + }; + + /** + * Encodes the specified StorageSource message. Does not implicitly {@link google.cloud.functions.v2.StorageSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {google.cloud.functions.v2.IStorageSource} message StorageSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.bucket); + if (message.object != null && Object.hasOwnProperty.call(message, "object")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.object); + if (message.generation != null && Object.hasOwnProperty.call(message, "generation")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.generation); + return writer; + }; + + /** + * Encodes the specified StorageSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2.StorageSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {google.cloud.functions.v2.IStorageSource} message StorageSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StorageSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StorageSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.StorageSource} StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.StorageSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bucket = reader.string(); + break; + case 2: + message.object = reader.string(); + break; + case 3: + message.generation = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StorageSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.StorageSource} StorageSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StorageSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StorageSource message. + * @function verify + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StorageSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) + if (!$util.isString(message.bucket)) + return "bucket: string expected"; + if (message.object != null && message.hasOwnProperty("object")) + if (!$util.isString(message.object)) + return "object: string expected"; + if (message.generation != null && message.hasOwnProperty("generation")) + if (!$util.isInteger(message.generation) && !(message.generation && $util.isInteger(message.generation.low) && $util.isInteger(message.generation.high))) + return "generation: integer|Long expected"; + return null; + }; + + /** + * Creates a StorageSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.StorageSource} StorageSource + */ + StorageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.StorageSource) + return object; + var message = new $root.google.cloud.functions.v2.StorageSource(); + if (object.bucket != null) + message.bucket = String(object.bucket); + if (object.object != null) + message.object = String(object.object); + if (object.generation != null) + if ($util.Long) + (message.generation = $util.Long.fromValue(object.generation)).unsigned = false; + else if (typeof object.generation === "string") + message.generation = parseInt(object.generation, 10); + else if (typeof object.generation === "number") + message.generation = object.generation; + else if (typeof object.generation === "object") + message.generation = new $util.LongBits(object.generation.low >>> 0, object.generation.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a StorageSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {google.cloud.functions.v2.StorageSource} message StorageSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StorageSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.bucket = ""; + object.object = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.generation = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.generation = options.longs === String ? "0" : 0; + } + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = message.bucket; + if (message.object != null && message.hasOwnProperty("object")) + object.object = message.object; + if (message.generation != null && message.hasOwnProperty("generation")) + if (typeof message.generation === "number") + object.generation = options.longs === String ? String(message.generation) : message.generation; + else + object.generation = options.longs === String ? $util.Long.prototype.toString.call(message.generation) : options.longs === Number ? new $util.LongBits(message.generation.low >>> 0, message.generation.high >>> 0).toNumber() : message.generation; + return object; + }; + + /** + * Converts this StorageSource to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.StorageSource + * @instance + * @returns {Object.} JSON object + */ + StorageSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StorageSource; + })(); + + v2.RepoSource = (function() { + + /** + * Properties of a RepoSource. + * @memberof google.cloud.functions.v2 + * @interface IRepoSource + * @property {string|null} [branchName] RepoSource branchName + * @property {string|null} [tagName] RepoSource tagName + * @property {string|null} [commitSha] RepoSource commitSha + * @property {string|null} [projectId] RepoSource projectId + * @property {string|null} [repoName] RepoSource repoName + * @property {string|null} [dir] RepoSource dir + * @property {boolean|null} [invertRegex] RepoSource invertRegex + */ + + /** + * Constructs a new RepoSource. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a RepoSource. + * @implements IRepoSource + * @constructor + * @param {google.cloud.functions.v2.IRepoSource=} [properties] Properties to set + */ + function RepoSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RepoSource branchName. + * @member {string|null|undefined} branchName + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.branchName = null; + + /** + * RepoSource tagName. + * @member {string|null|undefined} tagName + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.tagName = null; + + /** + * RepoSource commitSha. + * @member {string|null|undefined} commitSha + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.commitSha = null; + + /** + * RepoSource projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.projectId = ""; + + /** + * RepoSource repoName. + * @member {string} repoName + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.repoName = ""; + + /** + * RepoSource dir. + * @member {string} dir + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.dir = ""; + + /** + * RepoSource invertRegex. + * @member {boolean} invertRegex + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + RepoSource.prototype.invertRegex = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RepoSource revision. + * @member {"branchName"|"tagName"|"commitSha"|undefined} revision + * @memberof google.cloud.functions.v2.RepoSource + * @instance + */ + Object.defineProperty(RepoSource.prototype, "revision", { + get: $util.oneOfGetter($oneOfFields = ["branchName", "tagName", "commitSha"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RepoSource instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {google.cloud.functions.v2.IRepoSource=} [properties] Properties to set + * @returns {google.cloud.functions.v2.RepoSource} RepoSource instance + */ + RepoSource.create = function create(properties) { + return new RepoSource(properties); + }; + + /** + * Encodes the specified RepoSource message. Does not implicitly {@link google.cloud.functions.v2.RepoSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {google.cloud.functions.v2.IRepoSource} message RepoSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RepoSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.projectId); + if (message.repoName != null && Object.hasOwnProperty.call(message, "repoName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.repoName); + if (message.branchName != null && Object.hasOwnProperty.call(message, "branchName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.branchName); + if (message.tagName != null && Object.hasOwnProperty.call(message, "tagName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.tagName); + if (message.commitSha != null && Object.hasOwnProperty.call(message, "commitSha")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.commitSha); + if (message.dir != null && Object.hasOwnProperty.call(message, "dir")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.dir); + if (message.invertRegex != null && Object.hasOwnProperty.call(message, "invertRegex")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.invertRegex); + return writer; + }; + + /** + * Encodes the specified RepoSource message, length delimited. Does not implicitly {@link google.cloud.functions.v2.RepoSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {google.cloud.functions.v2.IRepoSource} message RepoSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RepoSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RepoSource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.RepoSource} RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RepoSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.RepoSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.branchName = reader.string(); + break; + case 4: + message.tagName = reader.string(); + break; + case 5: + message.commitSha = reader.string(); + break; + case 1: + message.projectId = reader.string(); + break; + case 2: + message.repoName = reader.string(); + break; + case 6: + message.dir = reader.string(); + break; + case 7: + message.invertRegex = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RepoSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.RepoSource} RepoSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RepoSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RepoSource message. + * @function verify + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RepoSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.branchName != null && message.hasOwnProperty("branchName")) { + properties.revision = 1; + if (!$util.isString(message.branchName)) + return "branchName: string expected"; + } + if (message.tagName != null && message.hasOwnProperty("tagName")) { + if (properties.revision === 1) + return "revision: multiple values"; + properties.revision = 1; + if (!$util.isString(message.tagName)) + return "tagName: string expected"; + } + if (message.commitSha != null && message.hasOwnProperty("commitSha")) { + if (properties.revision === 1) + return "revision: multiple values"; + properties.revision = 1; + if (!$util.isString(message.commitSha)) + return "commitSha: string expected"; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.repoName != null && message.hasOwnProperty("repoName")) + if (!$util.isString(message.repoName)) + return "repoName: string expected"; + if (message.dir != null && message.hasOwnProperty("dir")) + if (!$util.isString(message.dir)) + return "dir: string expected"; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + if (typeof message.invertRegex !== "boolean") + return "invertRegex: boolean expected"; + return null; + }; + + /** + * Creates a RepoSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.RepoSource} RepoSource + */ + RepoSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.RepoSource) + return object; + var message = new $root.google.cloud.functions.v2.RepoSource(); + if (object.branchName != null) + message.branchName = String(object.branchName); + if (object.tagName != null) + message.tagName = String(object.tagName); + if (object.commitSha != null) + message.commitSha = String(object.commitSha); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.repoName != null) + message.repoName = String(object.repoName); + if (object.dir != null) + message.dir = String(object.dir); + if (object.invertRegex != null) + message.invertRegex = Boolean(object.invertRegex); + return message; + }; + + /** + * Creates a plain object from a RepoSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {google.cloud.functions.v2.RepoSource} message RepoSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RepoSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.projectId = ""; + object.repoName = ""; + object.dir = ""; + object.invertRegex = false; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.repoName != null && message.hasOwnProperty("repoName")) + object.repoName = message.repoName; + if (message.branchName != null && message.hasOwnProperty("branchName")) { + object.branchName = message.branchName; + if (options.oneofs) + object.revision = "branchName"; + } + if (message.tagName != null && message.hasOwnProperty("tagName")) { + object.tagName = message.tagName; + if (options.oneofs) + object.revision = "tagName"; + } + if (message.commitSha != null && message.hasOwnProperty("commitSha")) { + object.commitSha = message.commitSha; + if (options.oneofs) + object.revision = "commitSha"; + } + if (message.dir != null && message.hasOwnProperty("dir")) + object.dir = message.dir; + if (message.invertRegex != null && message.hasOwnProperty("invertRegex")) + object.invertRegex = message.invertRegex; + return object; + }; + + /** + * Converts this RepoSource to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.RepoSource + * @instance + * @returns {Object.} JSON object + */ + RepoSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RepoSource; + })(); + + v2.Source = (function() { + + /** + * Properties of a Source. + * @memberof google.cloud.functions.v2 + * @interface ISource + * @property {google.cloud.functions.v2.IStorageSource|null} [storageSource] Source storageSource + * @property {google.cloud.functions.v2.IRepoSource|null} [repoSource] Source repoSource + */ + + /** + * Constructs a new Source. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a Source. + * @implements ISource + * @constructor + * @param {google.cloud.functions.v2.ISource=} [properties] Properties to set + */ + function Source(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Source storageSource. + * @member {google.cloud.functions.v2.IStorageSource|null|undefined} storageSource + * @memberof google.cloud.functions.v2.Source + * @instance + */ + Source.prototype.storageSource = null; + + /** + * Source repoSource. + * @member {google.cloud.functions.v2.IRepoSource|null|undefined} repoSource + * @memberof google.cloud.functions.v2.Source + * @instance + */ + Source.prototype.repoSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Source source. + * @member {"storageSource"|"repoSource"|undefined} source + * @memberof google.cloud.functions.v2.Source + * @instance + */ + Object.defineProperty(Source.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["storageSource", "repoSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Source instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.Source + * @static + * @param {google.cloud.functions.v2.ISource=} [properties] Properties to set + * @returns {google.cloud.functions.v2.Source} Source instance + */ + Source.create = function create(properties) { + return new Source(properties); + }; + + /** + * Encodes the specified Source message. Does not implicitly {@link google.cloud.functions.v2.Source.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.Source + * @static + * @param {google.cloud.functions.v2.ISource} message Source message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Source.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.storageSource != null && Object.hasOwnProperty.call(message, "storageSource")) + $root.google.cloud.functions.v2.StorageSource.encode(message.storageSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.repoSource != null && Object.hasOwnProperty.call(message, "repoSource")) + $root.google.cloud.functions.v2.RepoSource.encode(message.repoSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Source message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Source.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.Source + * @static + * @param {google.cloud.functions.v2.ISource} message Source message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Source.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Source message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.Source + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.Source} Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Source.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.Source(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.storageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + case 2: + message.repoSource = $root.google.cloud.functions.v2.RepoSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Source message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.Source + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.Source} Source + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Source.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Source message. + * @function verify + * @memberof google.cloud.functions.v2.Source + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Source.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + properties.source = 1; + { + var error = $root.google.cloud.functions.v2.StorageSource.verify(message.storageSource); + if (error) + return "storageSource." + error; + } + } + if (message.repoSource != null && message.hasOwnProperty("repoSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.functions.v2.RepoSource.verify(message.repoSource); + if (error) + return "repoSource." + error; + } + } + return null; + }; + + /** + * Creates a Source message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.Source + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.Source} Source + */ + Source.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.Source) + return object; + var message = new $root.google.cloud.functions.v2.Source(); + if (object.storageSource != null) { + if (typeof object.storageSource !== "object") + throw TypeError(".google.cloud.functions.v2.Source.storageSource: object expected"); + message.storageSource = $root.google.cloud.functions.v2.StorageSource.fromObject(object.storageSource); + } + if (object.repoSource != null) { + if (typeof object.repoSource !== "object") + throw TypeError(".google.cloud.functions.v2.Source.repoSource: object expected"); + message.repoSource = $root.google.cloud.functions.v2.RepoSource.fromObject(object.repoSource); + } + return message; + }; + + /** + * Creates a plain object from a Source message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.Source + * @static + * @param {google.cloud.functions.v2.Source} message Source + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Source.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + object.storageSource = $root.google.cloud.functions.v2.StorageSource.toObject(message.storageSource, options); + if (options.oneofs) + object.source = "storageSource"; + } + if (message.repoSource != null && message.hasOwnProperty("repoSource")) { + object.repoSource = $root.google.cloud.functions.v2.RepoSource.toObject(message.repoSource, options); + if (options.oneofs) + object.source = "repoSource"; + } + return object; + }; + + /** + * Converts this Source to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.Source + * @instance + * @returns {Object.} JSON object + */ + Source.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Source; + })(); + + v2.SourceProvenance = (function() { + + /** + * Properties of a SourceProvenance. + * @memberof google.cloud.functions.v2 + * @interface ISourceProvenance + * @property {google.cloud.functions.v2.IStorageSource|null} [resolvedStorageSource] SourceProvenance resolvedStorageSource + * @property {google.cloud.functions.v2.IRepoSource|null} [resolvedRepoSource] SourceProvenance resolvedRepoSource + */ + + /** + * Constructs a new SourceProvenance. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a SourceProvenance. + * @implements ISourceProvenance + * @constructor + * @param {google.cloud.functions.v2.ISourceProvenance=} [properties] Properties to set + */ + function SourceProvenance(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceProvenance resolvedStorageSource. + * @member {google.cloud.functions.v2.IStorageSource|null|undefined} resolvedStorageSource + * @memberof google.cloud.functions.v2.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedStorageSource = null; + + /** + * SourceProvenance resolvedRepoSource. + * @member {google.cloud.functions.v2.IRepoSource|null|undefined} resolvedRepoSource + * @memberof google.cloud.functions.v2.SourceProvenance + * @instance + */ + SourceProvenance.prototype.resolvedRepoSource = null; + + /** + * Creates a new SourceProvenance instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {google.cloud.functions.v2.ISourceProvenance=} [properties] Properties to set + * @returns {google.cloud.functions.v2.SourceProvenance} SourceProvenance instance + */ + SourceProvenance.create = function create(properties) { + return new SourceProvenance(properties); + }; + + /** + * Encodes the specified SourceProvenance message. Does not implicitly {@link google.cloud.functions.v2.SourceProvenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {google.cloud.functions.v2.ISourceProvenance} message SourceProvenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceProvenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resolvedStorageSource != null && Object.hasOwnProperty.call(message, "resolvedStorageSource")) + $root.google.cloud.functions.v2.StorageSource.encode(message.resolvedStorageSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.resolvedRepoSource != null && Object.hasOwnProperty.call(message, "resolvedRepoSource")) + $root.google.cloud.functions.v2.RepoSource.encode(message.resolvedRepoSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceProvenance message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SourceProvenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {google.cloud.functions.v2.ISourceProvenance} message SourceProvenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceProvenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.SourceProvenance} SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceProvenance.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.SourceProvenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resolvedStorageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + case 2: + message.resolvedRepoSource = $root.google.cloud.functions.v2.RepoSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceProvenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.SourceProvenance} SourceProvenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceProvenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceProvenance message. + * @function verify + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceProvenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) { + var error = $root.google.cloud.functions.v2.StorageSource.verify(message.resolvedStorageSource); + if (error) + return "resolvedStorageSource." + error; + } + if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) { + var error = $root.google.cloud.functions.v2.RepoSource.verify(message.resolvedRepoSource); + if (error) + return "resolvedRepoSource." + error; + } + return null; + }; + + /** + * Creates a SourceProvenance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.SourceProvenance} SourceProvenance + */ + SourceProvenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.SourceProvenance) + return object; + var message = new $root.google.cloud.functions.v2.SourceProvenance(); + if (object.resolvedStorageSource != null) { + if (typeof object.resolvedStorageSource !== "object") + throw TypeError(".google.cloud.functions.v2.SourceProvenance.resolvedStorageSource: object expected"); + message.resolvedStorageSource = $root.google.cloud.functions.v2.StorageSource.fromObject(object.resolvedStorageSource); + } + if (object.resolvedRepoSource != null) { + if (typeof object.resolvedRepoSource !== "object") + throw TypeError(".google.cloud.functions.v2.SourceProvenance.resolvedRepoSource: object expected"); + message.resolvedRepoSource = $root.google.cloud.functions.v2.RepoSource.fromObject(object.resolvedRepoSource); + } + return message; + }; + + /** + * Creates a plain object from a SourceProvenance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {google.cloud.functions.v2.SourceProvenance} message SourceProvenance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceProvenance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resolvedStorageSource = null; + object.resolvedRepoSource = null; + } + if (message.resolvedStorageSource != null && message.hasOwnProperty("resolvedStorageSource")) + object.resolvedStorageSource = $root.google.cloud.functions.v2.StorageSource.toObject(message.resolvedStorageSource, options); + if (message.resolvedRepoSource != null && message.hasOwnProperty("resolvedRepoSource")) + object.resolvedRepoSource = $root.google.cloud.functions.v2.RepoSource.toObject(message.resolvedRepoSource, options); + return object; + }; + + /** + * Converts this SourceProvenance to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.SourceProvenance + * @instance + * @returns {Object.} JSON object + */ + SourceProvenance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SourceProvenance; + })(); + + v2.BuildConfig = (function() { + + /** + * Properties of a BuildConfig. + * @memberof google.cloud.functions.v2 + * @interface IBuildConfig + * @property {string|null} [build] BuildConfig build + * @property {string|null} [runtime] BuildConfig runtime + * @property {string|null} [entryPoint] BuildConfig entryPoint + * @property {google.cloud.functions.v2.ISource|null} [source] BuildConfig source + * @property {google.cloud.functions.v2.ISourceProvenance|null} [sourceProvenance] BuildConfig sourceProvenance + * @property {string|null} [workerPool] BuildConfig workerPool + * @property {Object.|null} [environmentVariables] BuildConfig environmentVariables + * @property {string|null} [dockerRepository] BuildConfig dockerRepository + */ + + /** + * Constructs a new BuildConfig. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a BuildConfig. + * @implements IBuildConfig + * @constructor + * @param {google.cloud.functions.v2.IBuildConfig=} [properties] Properties to set + */ + function BuildConfig(properties) { + this.environmentVariables = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BuildConfig build. + * @member {string} build + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.build = ""; + + /** + * BuildConfig runtime. + * @member {string} runtime + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.runtime = ""; + + /** + * BuildConfig entryPoint. + * @member {string} entryPoint + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.entryPoint = ""; + + /** + * BuildConfig source. + * @member {google.cloud.functions.v2.ISource|null|undefined} source + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.source = null; + + /** + * BuildConfig sourceProvenance. + * @member {google.cloud.functions.v2.ISourceProvenance|null|undefined} sourceProvenance + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.sourceProvenance = null; + + /** + * BuildConfig workerPool. + * @member {string} workerPool + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.workerPool = ""; + + /** + * BuildConfig environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.environmentVariables = $util.emptyObject; + + /** + * BuildConfig dockerRepository. + * @member {string} dockerRepository + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + */ + BuildConfig.prototype.dockerRepository = ""; + + /** + * Creates a new BuildConfig instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {google.cloud.functions.v2.IBuildConfig=} [properties] Properties to set + * @returns {google.cloud.functions.v2.BuildConfig} BuildConfig instance + */ + BuildConfig.create = function create(properties) { + return new BuildConfig(properties); + }; + + /** + * Encodes the specified BuildConfig message. Does not implicitly {@link google.cloud.functions.v2.BuildConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {google.cloud.functions.v2.IBuildConfig} message BuildConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.build != null && Object.hasOwnProperty.call(message, "build")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.build); + if (message.runtime != null && Object.hasOwnProperty.call(message, "runtime")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.runtime); + if (message.entryPoint != null && Object.hasOwnProperty.call(message, "entryPoint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.entryPoint); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + $root.google.cloud.functions.v2.Source.encode(message.source, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.workerPool != null && Object.hasOwnProperty.call(message, "workerPool")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.workerPool); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environmentVariables[keys[i]]).ldelim(); + if (message.dockerRepository != null && Object.hasOwnProperty.call(message, "dockerRepository")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.dockerRepository); + if (message.sourceProvenance != null && Object.hasOwnProperty.call(message, "sourceProvenance")) + $root.google.cloud.functions.v2.SourceProvenance.encode(message.sourceProvenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BuildConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2.BuildConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {google.cloud.functions.v2.IBuildConfig} message BuildConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BuildConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BuildConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.BuildConfig} BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.BuildConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.build = reader.string(); + break; + case 2: + message.runtime = reader.string(); + break; + case 3: + message.entryPoint = reader.string(); + break; + case 4: + message.source = $root.google.cloud.functions.v2.Source.decode(reader, reader.uint32()); + break; + case 8: + message.sourceProvenance = $root.google.cloud.functions.v2.SourceProvenance.decode(reader, reader.uint32()); + break; + case 5: + message.workerPool = reader.string(); + break; + case 6: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.environmentVariables[key] = value; + break; + case 7: + message.dockerRepository = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BuildConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.BuildConfig} BuildConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BuildConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BuildConfig message. + * @function verify + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BuildConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.build != null && message.hasOwnProperty("build")) + if (!$util.isString(message.build)) + return "build: string expected"; + if (message.runtime != null && message.hasOwnProperty("runtime")) + if (!$util.isString(message.runtime)) + return "runtime: string expected"; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + if (!$util.isString(message.entryPoint)) + return "entryPoint: string expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.functions.v2.Source.verify(message.source); + if (error) + return "source." + error; + } + if (message.sourceProvenance != null && message.hasOwnProperty("sourceProvenance")) { + var error = $root.google.cloud.functions.v2.SourceProvenance.verify(message.sourceProvenance); + if (error) + return "sourceProvenance." + error; + } + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + if (!$util.isString(message.workerPool)) + return "workerPool: string expected"; + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + if (!$util.isString(message.dockerRepository)) + return "dockerRepository: string expected"; + return null; + }; + + /** + * Creates a BuildConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.BuildConfig} BuildConfig + */ + BuildConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.BuildConfig) + return object; + var message = new $root.google.cloud.functions.v2.BuildConfig(); + if (object.build != null) + message.build = String(object.build); + if (object.runtime != null) + message.runtime = String(object.runtime); + if (object.entryPoint != null) + message.entryPoint = String(object.entryPoint); + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.functions.v2.BuildConfig.source: object expected"); + message.source = $root.google.cloud.functions.v2.Source.fromObject(object.source); + } + if (object.sourceProvenance != null) { + if (typeof object.sourceProvenance !== "object") + throw TypeError(".google.cloud.functions.v2.BuildConfig.sourceProvenance: object expected"); + message.sourceProvenance = $root.google.cloud.functions.v2.SourceProvenance.fromObject(object.sourceProvenance); + } + if (object.workerPool != null) + message.workerPool = String(object.workerPool); + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v2.BuildConfig.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.dockerRepository != null) + message.dockerRepository = String(object.dockerRepository); + return message; + }; + + /** + * Creates a plain object from a BuildConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {google.cloud.functions.v2.BuildConfig} message BuildConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BuildConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.environmentVariables = {}; + if (options.defaults) { + object.build = ""; + object.runtime = ""; + object.entryPoint = ""; + object.source = null; + object.workerPool = ""; + object.dockerRepository = ""; + object.sourceProvenance = null; + } + if (message.build != null && message.hasOwnProperty("build")) + object.build = message.build; + if (message.runtime != null && message.hasOwnProperty("runtime")) + object.runtime = message.runtime; + if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) + object.entryPoint = message.entryPoint; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.functions.v2.Source.toObject(message.source, options); + if (message.workerPool != null && message.hasOwnProperty("workerPool")) + object.workerPool = message.workerPool; + var keys2; + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) + object.dockerRepository = message.dockerRepository; + if (message.sourceProvenance != null && message.hasOwnProperty("sourceProvenance")) + object.sourceProvenance = $root.google.cloud.functions.v2.SourceProvenance.toObject(message.sourceProvenance, options); + return object; + }; + + /** + * Converts this BuildConfig to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.BuildConfig + * @instance + * @returns {Object.} JSON object + */ + BuildConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BuildConfig; + })(); + + v2.ServiceConfig = (function() { + + /** + * Properties of a ServiceConfig. + * @memberof google.cloud.functions.v2 + * @interface IServiceConfig + * @property {string|null} [service] ServiceConfig service + * @property {number|null} [timeoutSeconds] ServiceConfig timeoutSeconds + * @property {string|null} [availableMemory] ServiceConfig availableMemory + * @property {Object.|null} [environmentVariables] ServiceConfig environmentVariables + * @property {number|null} [maxInstanceCount] ServiceConfig maxInstanceCount + * @property {number|null} [minInstanceCount] ServiceConfig minInstanceCount + * @property {string|null} [vpcConnector] ServiceConfig vpcConnector + * @property {google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings|null} [vpcConnectorEgressSettings] ServiceConfig vpcConnectorEgressSettings + * @property {google.cloud.functions.v2.ServiceConfig.IngressSettings|null} [ingressSettings] ServiceConfig ingressSettings + * @property {string|null} [uri] ServiceConfig uri + * @property {string|null} [serviceAccountEmail] ServiceConfig serviceAccountEmail + * @property {boolean|null} [allTrafficOnLatestRevision] ServiceConfig allTrafficOnLatestRevision + * @property {Array.|null} [secretEnvironmentVariables] ServiceConfig secretEnvironmentVariables + * @property {Array.|null} [secretVolumes] ServiceConfig secretVolumes + * @property {string|null} [revision] ServiceConfig revision + */ + + /** + * Constructs a new ServiceConfig. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ServiceConfig. + * @implements IServiceConfig + * @constructor + * @param {google.cloud.functions.v2.IServiceConfig=} [properties] Properties to set + */ + function ServiceConfig(properties) { + this.environmentVariables = {}; + this.secretEnvironmentVariables = []; + this.secretVolumes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceConfig service. + * @member {string} service + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.service = ""; + + /** + * ServiceConfig timeoutSeconds. + * @member {number} timeoutSeconds + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.timeoutSeconds = 0; + + /** + * ServiceConfig availableMemory. + * @member {string} availableMemory + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.availableMemory = ""; + + /** + * ServiceConfig environmentVariables. + * @member {Object.} environmentVariables + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.environmentVariables = $util.emptyObject; + + /** + * ServiceConfig maxInstanceCount. + * @member {number} maxInstanceCount + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.maxInstanceCount = 0; + + /** + * ServiceConfig minInstanceCount. + * @member {number} minInstanceCount + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.minInstanceCount = 0; + + /** + * ServiceConfig vpcConnector. + * @member {string} vpcConnector + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.vpcConnector = ""; + + /** + * ServiceConfig vpcConnectorEgressSettings. + * @member {google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings} vpcConnectorEgressSettings + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.vpcConnectorEgressSettings = 0; + + /** + * ServiceConfig ingressSettings. + * @member {google.cloud.functions.v2.ServiceConfig.IngressSettings} ingressSettings + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.ingressSettings = 0; + + /** + * ServiceConfig uri. + * @member {string} uri + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.uri = ""; + + /** + * ServiceConfig serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.serviceAccountEmail = ""; + + /** + * ServiceConfig allTrafficOnLatestRevision. + * @member {boolean} allTrafficOnLatestRevision + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.allTrafficOnLatestRevision = false; + + /** + * ServiceConfig secretEnvironmentVariables. + * @member {Array.} secretEnvironmentVariables + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.secretEnvironmentVariables = $util.emptyArray; + + /** + * ServiceConfig secretVolumes. + * @member {Array.} secretVolumes + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.secretVolumes = $util.emptyArray; + + /** + * ServiceConfig revision. + * @member {string} revision + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + */ + ServiceConfig.prototype.revision = ""; + + /** + * Creates a new ServiceConfig instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {google.cloud.functions.v2.IServiceConfig=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ServiceConfig} ServiceConfig instance + */ + ServiceConfig.create = function create(properties) { + return new ServiceConfig(properties); + }; + + /** + * Encodes the specified ServiceConfig message. Does not implicitly {@link google.cloud.functions.v2.ServiceConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {google.cloud.functions.v2.IServiceConfig} message ServiceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.service); + if (message.timeoutSeconds != null && Object.hasOwnProperty.call(message, "timeoutSeconds")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.timeoutSeconds); + if (message.environmentVariables != null && Object.hasOwnProperty.call(message, "environmentVariables")) + for (var keys = Object.keys(message.environmentVariables), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.environmentVariables[keys[i]]).ldelim(); + if (message.maxInstanceCount != null && Object.hasOwnProperty.call(message, "maxInstanceCount")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxInstanceCount); + if (message.vpcConnector != null && Object.hasOwnProperty.call(message, "vpcConnector")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.vpcConnector); + if (message.vpcConnectorEgressSettings != null && Object.hasOwnProperty.call(message, "vpcConnectorEgressSettings")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.vpcConnectorEgressSettings); + if (message.ingressSettings != null && Object.hasOwnProperty.call(message, "ingressSettings")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.ingressSettings); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.uri); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.serviceAccountEmail); + if (message.minInstanceCount != null && Object.hasOwnProperty.call(message, "minInstanceCount")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.minInstanceCount); + if (message.availableMemory != null && Object.hasOwnProperty.call(message, "availableMemory")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.availableMemory); + if (message.allTrafficOnLatestRevision != null && Object.hasOwnProperty.call(message, "allTrafficOnLatestRevision")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.allTrafficOnLatestRevision); + if (message.secretEnvironmentVariables != null && message.secretEnvironmentVariables.length) + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) + $root.google.cloud.functions.v2.SecretEnvVar.encode(message.secretEnvironmentVariables[i], writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.revision != null && Object.hasOwnProperty.call(message, "revision")) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.revision); + if (message.secretVolumes != null && message.secretVolumes.length) + for (var i = 0; i < message.secretVolumes.length; ++i) + $root.google.cloud.functions.v2.SecretVolume.encode(message.secretVolumes[i], writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceConfig message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ServiceConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {google.cloud.functions.v2.IServiceConfig} message ServiceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ServiceConfig} ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ServiceConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.service = reader.string(); + break; + case 2: + message.timeoutSeconds = reader.int32(); + break; + case 13: + message.availableMemory = reader.string(); + break; + case 4: + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.environmentVariables[key] = value; + break; + case 5: + message.maxInstanceCount = reader.int32(); + break; + case 12: + message.minInstanceCount = reader.int32(); + break; + case 6: + message.vpcConnector = reader.string(); + break; + case 7: + message.vpcConnectorEgressSettings = reader.int32(); + break; + case 8: + message.ingressSettings = reader.int32(); + break; + case 9: + message.uri = reader.string(); + break; + case 10: + message.serviceAccountEmail = reader.string(); + break; + case 16: + message.allTrafficOnLatestRevision = reader.bool(); + break; + case 17: + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v2.SecretEnvVar.decode(reader, reader.uint32())); + break; + case 19: + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v2.SecretVolume.decode(reader, reader.uint32())); + break; + case 18: + message.revision = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ServiceConfig} ServiceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceConfig message. + * @function verify + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.timeoutSeconds != null && message.hasOwnProperty("timeoutSeconds")) + if (!$util.isInteger(message.timeoutSeconds)) + return "timeoutSeconds: integer expected"; + if (message.availableMemory != null && message.hasOwnProperty("availableMemory")) + if (!$util.isString(message.availableMemory)) + return "availableMemory: string expected"; + if (message.environmentVariables != null && message.hasOwnProperty("environmentVariables")) { + if (!$util.isObject(message.environmentVariables)) + return "environmentVariables: object expected"; + var key = Object.keys(message.environmentVariables); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.environmentVariables[key[i]])) + return "environmentVariables: string{k:string} expected"; + } + if (message.maxInstanceCount != null && message.hasOwnProperty("maxInstanceCount")) + if (!$util.isInteger(message.maxInstanceCount)) + return "maxInstanceCount: integer expected"; + if (message.minInstanceCount != null && message.hasOwnProperty("minInstanceCount")) + if (!$util.isInteger(message.minInstanceCount)) + return "minInstanceCount: integer expected"; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + if (!$util.isString(message.vpcConnector)) + return "vpcConnector: string expected"; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + switch (message.vpcConnectorEgressSettings) { + default: + return "vpcConnectorEgressSettings: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + switch (message.ingressSettings) { + default: + return "ingressSettings: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.allTrafficOnLatestRevision != null && message.hasOwnProperty("allTrafficOnLatestRevision")) + if (typeof message.allTrafficOnLatestRevision !== "boolean") + return "allTrafficOnLatestRevision: boolean expected"; + if (message.secretEnvironmentVariables != null && message.hasOwnProperty("secretEnvironmentVariables")) { + if (!Array.isArray(message.secretEnvironmentVariables)) + return "secretEnvironmentVariables: array expected"; + for (var i = 0; i < message.secretEnvironmentVariables.length; ++i) { + var error = $root.google.cloud.functions.v2.SecretEnvVar.verify(message.secretEnvironmentVariables[i]); + if (error) + return "secretEnvironmentVariables." + error; + } + } + if (message.secretVolumes != null && message.hasOwnProperty("secretVolumes")) { + if (!Array.isArray(message.secretVolumes)) + return "secretVolumes: array expected"; + for (var i = 0; i < message.secretVolumes.length; ++i) { + var error = $root.google.cloud.functions.v2.SecretVolume.verify(message.secretVolumes[i]); + if (error) + return "secretVolumes." + error; + } + } + if (message.revision != null && message.hasOwnProperty("revision")) + if (!$util.isString(message.revision)) + return "revision: string expected"; + return null; + }; + + /** + * Creates a ServiceConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ServiceConfig} ServiceConfig + */ + ServiceConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ServiceConfig) + return object; + var message = new $root.google.cloud.functions.v2.ServiceConfig(); + if (object.service != null) + message.service = String(object.service); + if (object.timeoutSeconds != null) + message.timeoutSeconds = object.timeoutSeconds | 0; + if (object.availableMemory != null) + message.availableMemory = String(object.availableMemory); + if (object.environmentVariables) { + if (typeof object.environmentVariables !== "object") + throw TypeError(".google.cloud.functions.v2.ServiceConfig.environmentVariables: object expected"); + message.environmentVariables = {}; + for (var keys = Object.keys(object.environmentVariables), i = 0; i < keys.length; ++i) + message.environmentVariables[keys[i]] = String(object.environmentVariables[keys[i]]); + } + if (object.maxInstanceCount != null) + message.maxInstanceCount = object.maxInstanceCount | 0; + if (object.minInstanceCount != null) + message.minInstanceCount = object.minInstanceCount | 0; + if (object.vpcConnector != null) + message.vpcConnector = String(object.vpcConnector); + switch (object.vpcConnectorEgressSettings) { + case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.vpcConnectorEgressSettings = 0; + break; + case "PRIVATE_RANGES_ONLY": + case 1: + message.vpcConnectorEgressSettings = 1; + break; + case "ALL_TRAFFIC": + case 2: + message.vpcConnectorEgressSettings = 2; + break; + } + switch (object.ingressSettings) { + case "INGRESS_SETTINGS_UNSPECIFIED": + case 0: + message.ingressSettings = 0; + break; + case "ALLOW_ALL": + case 1: + message.ingressSettings = 1; + break; + case "ALLOW_INTERNAL_ONLY": + case 2: + message.ingressSettings = 2; + break; + case "ALLOW_INTERNAL_AND_GCLB": + case 3: + message.ingressSettings = 3; + break; + } + if (object.uri != null) + message.uri = String(object.uri); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + if (object.allTrafficOnLatestRevision != null) + message.allTrafficOnLatestRevision = Boolean(object.allTrafficOnLatestRevision); + if (object.secretEnvironmentVariables) { + if (!Array.isArray(object.secretEnvironmentVariables)) + throw TypeError(".google.cloud.functions.v2.ServiceConfig.secretEnvironmentVariables: array expected"); + message.secretEnvironmentVariables = []; + for (var i = 0; i < object.secretEnvironmentVariables.length; ++i) { + if (typeof object.secretEnvironmentVariables[i] !== "object") + throw TypeError(".google.cloud.functions.v2.ServiceConfig.secretEnvironmentVariables: object expected"); + message.secretEnvironmentVariables[i] = $root.google.cloud.functions.v2.SecretEnvVar.fromObject(object.secretEnvironmentVariables[i]); + } + } + if (object.secretVolumes) { + if (!Array.isArray(object.secretVolumes)) + throw TypeError(".google.cloud.functions.v2.ServiceConfig.secretVolumes: array expected"); + message.secretVolumes = []; + for (var i = 0; i < object.secretVolumes.length; ++i) { + if (typeof object.secretVolumes[i] !== "object") + throw TypeError(".google.cloud.functions.v2.ServiceConfig.secretVolumes: object expected"); + message.secretVolumes[i] = $root.google.cloud.functions.v2.SecretVolume.fromObject(object.secretVolumes[i]); + } + } + if (object.revision != null) + message.revision = String(object.revision); + return message; + }; + + /** + * Creates a plain object from a ServiceConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {google.cloud.functions.v2.ServiceConfig} message ServiceConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.secretEnvironmentVariables = []; + object.secretVolumes = []; + } + if (options.objects || options.defaults) + object.environmentVariables = {}; + if (options.defaults) { + object.service = ""; + object.timeoutSeconds = 0; + object.maxInstanceCount = 0; + object.vpcConnector = ""; + object.vpcConnectorEgressSettings = options.enums === String ? "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" : 0; + object.ingressSettings = options.enums === String ? "INGRESS_SETTINGS_UNSPECIFIED" : 0; + object.uri = ""; + object.serviceAccountEmail = ""; + object.minInstanceCount = 0; + object.availableMemory = ""; + object.allTrafficOnLatestRevision = false; + object.revision = ""; + } + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.timeoutSeconds != null && message.hasOwnProperty("timeoutSeconds")) + object.timeoutSeconds = message.timeoutSeconds; + var keys2; + if (message.environmentVariables && (keys2 = Object.keys(message.environmentVariables)).length) { + object.environmentVariables = {}; + for (var j = 0; j < keys2.length; ++j) + object.environmentVariables[keys2[j]] = message.environmentVariables[keys2[j]]; + } + if (message.maxInstanceCount != null && message.hasOwnProperty("maxInstanceCount")) + object.maxInstanceCount = message.maxInstanceCount; + if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) + object.vpcConnector = message.vpcConnector; + if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.minInstanceCount != null && message.hasOwnProperty("minInstanceCount")) + object.minInstanceCount = message.minInstanceCount; + if (message.availableMemory != null && message.hasOwnProperty("availableMemory")) + object.availableMemory = message.availableMemory; + if (message.allTrafficOnLatestRevision != null && message.hasOwnProperty("allTrafficOnLatestRevision")) + object.allTrafficOnLatestRevision = message.allTrafficOnLatestRevision; + if (message.secretEnvironmentVariables && message.secretEnvironmentVariables.length) { + object.secretEnvironmentVariables = []; + for (var j = 0; j < message.secretEnvironmentVariables.length; ++j) + object.secretEnvironmentVariables[j] = $root.google.cloud.functions.v2.SecretEnvVar.toObject(message.secretEnvironmentVariables[j], options); + } + if (message.revision != null && message.hasOwnProperty("revision")) + object.revision = message.revision; + if (message.secretVolumes && message.secretVolumes.length) { + object.secretVolumes = []; + for (var j = 0; j < message.secretVolumes.length; ++j) + object.secretVolumes[j] = $root.google.cloud.functions.v2.SecretVolume.toObject(message.secretVolumes[j], options); + } + return object; + }; + + /** + * Converts this ServiceConfig to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ServiceConfig + * @instance + * @returns {Object.} JSON object + */ + ServiceConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * VpcConnectorEgressSettings enum. + * @name google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings + * @enum {number} + * @property {number} VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED=0 VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED value + * @property {number} PRIVATE_RANGES_ONLY=1 PRIVATE_RANGES_ONLY value + * @property {number} ALL_TRAFFIC=2 ALL_TRAFFIC value + */ + ServiceConfig.VpcConnectorEgressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIVATE_RANGES_ONLY"] = 1; + values[valuesById[2] = "ALL_TRAFFIC"] = 2; + return values; + })(); + + /** + * IngressSettings enum. + * @name google.cloud.functions.v2.ServiceConfig.IngressSettings + * @enum {number} + * @property {number} INGRESS_SETTINGS_UNSPECIFIED=0 INGRESS_SETTINGS_UNSPECIFIED value + * @property {number} ALLOW_ALL=1 ALLOW_ALL value + * @property {number} ALLOW_INTERNAL_ONLY=2 ALLOW_INTERNAL_ONLY value + * @property {number} ALLOW_INTERNAL_AND_GCLB=3 ALLOW_INTERNAL_AND_GCLB value + */ + ServiceConfig.IngressSettings = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INGRESS_SETTINGS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALLOW_ALL"] = 1; + values[valuesById[2] = "ALLOW_INTERNAL_ONLY"] = 2; + values[valuesById[3] = "ALLOW_INTERNAL_AND_GCLB"] = 3; + return values; + })(); + + return ServiceConfig; + })(); + + v2.SecretEnvVar = (function() { + + /** + * Properties of a SecretEnvVar. + * @memberof google.cloud.functions.v2 + * @interface ISecretEnvVar + * @property {string|null} [key] SecretEnvVar key + * @property {string|null} [projectId] SecretEnvVar projectId + * @property {string|null} [secret] SecretEnvVar secret + * @property {string|null} [version] SecretEnvVar version + */ + + /** + * Constructs a new SecretEnvVar. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a SecretEnvVar. + * @implements ISecretEnvVar + * @constructor + * @param {google.cloud.functions.v2.ISecretEnvVar=} [properties] Properties to set + */ + function SecretEnvVar(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretEnvVar key. + * @member {string} key + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.key = ""; + + /** + * SecretEnvVar projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.projectId = ""; + + /** + * SecretEnvVar secret. + * @member {string} secret + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.secret = ""; + + /** + * SecretEnvVar version. + * @member {string} version + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + */ + SecretEnvVar.prototype.version = ""; + + /** + * Creates a new SecretEnvVar instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {google.cloud.functions.v2.ISecretEnvVar=} [properties] Properties to set + * @returns {google.cloud.functions.v2.SecretEnvVar} SecretEnvVar instance + */ + SecretEnvVar.create = function create(properties) { + return new SecretEnvVar(properties); + }; + + /** + * Encodes the specified SecretEnvVar message. Does not implicitly {@link google.cloud.functions.v2.SecretEnvVar.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {google.cloud.functions.v2.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.version); + return writer; + }; + + /** + * Encodes the specified SecretEnvVar message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretEnvVar.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {google.cloud.functions.v2.ISecretEnvVar} message SecretEnvVar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretEnvVar.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.SecretEnvVar(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretEnvVar message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.SecretEnvVar} SecretEnvVar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretEnvVar.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretEnvVar message. + * @function verify + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretEnvVar.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a SecretEnvVar message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.SecretEnvVar} SecretEnvVar + */ + SecretEnvVar.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.SecretEnvVar) + return object; + var message = new $root.google.cloud.functions.v2.SecretEnvVar(); + if (object.key != null) + message.key = String(object.key); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a SecretEnvVar message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {google.cloud.functions.v2.SecretEnvVar} message SecretEnvVar + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretEnvVar.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = ""; + object.projectId = ""; + object.secret = ""; + object.version = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this SecretEnvVar to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.SecretEnvVar + * @instance + * @returns {Object.} JSON object + */ + SecretEnvVar.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecretEnvVar; + })(); + + v2.SecretVolume = (function() { + + /** + * Properties of a SecretVolume. + * @memberof google.cloud.functions.v2 + * @interface ISecretVolume + * @property {string|null} [mountPath] SecretVolume mountPath + * @property {string|null} [projectId] SecretVolume projectId + * @property {string|null} [secret] SecretVolume secret + * @property {Array.|null} [versions] SecretVolume versions + */ + + /** + * Constructs a new SecretVolume. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a SecretVolume. + * @implements ISecretVolume + * @constructor + * @param {google.cloud.functions.v2.ISecretVolume=} [properties] Properties to set + */ + function SecretVolume(properties) { + this.versions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretVolume mountPath. + * @member {string} mountPath + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + */ + SecretVolume.prototype.mountPath = ""; + + /** + * SecretVolume projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + */ + SecretVolume.prototype.projectId = ""; + + /** + * SecretVolume secret. + * @member {string} secret + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + */ + SecretVolume.prototype.secret = ""; + + /** + * SecretVolume versions. + * @member {Array.} versions + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + */ + SecretVolume.prototype.versions = $util.emptyArray; + + /** + * Creates a new SecretVolume instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {google.cloud.functions.v2.ISecretVolume=} [properties] Properties to set + * @returns {google.cloud.functions.v2.SecretVolume} SecretVolume instance + */ + SecretVolume.create = function create(properties) { + return new SecretVolume(properties); + }; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {google.cloud.functions.v2.ISecretVolume} message SecretVolume message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVolume.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mountPath != null && Object.hasOwnProperty.call(message, "mountPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mountPath); + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.secret); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.google.cloud.functions.v2.SecretVolume.SecretVersion.encode(message.versions[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SecretVolume message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {google.cloud.functions.v2.ISecretVolume} message SecretVolume message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVolume.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretVolume message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.SecretVolume} SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVolume.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.SecretVolume(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mountPath = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.secret = reader.string(); + break; + case 4: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v2.SecretVolume.SecretVersion.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretVolume message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.SecretVolume} SecretVolume + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVolume.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretVolume message. + * @function verify + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretVolume.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + if (!$util.isString(message.mountPath)) + return "mountPath: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.google.cloud.functions.v2.SecretVolume.SecretVersion.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + return null; + }; + + /** + * Creates a SecretVolume message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.SecretVolume} SecretVolume + */ + SecretVolume.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.SecretVolume) + return object; + var message = new $root.google.cloud.functions.v2.SecretVolume(); + if (object.mountPath != null) + message.mountPath = String(object.mountPath); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.secret != null) + message.secret = String(object.secret); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".google.cloud.functions.v2.SecretVolume.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".google.cloud.functions.v2.SecretVolume.versions: object expected"); + message.versions[i] = $root.google.cloud.functions.v2.SecretVolume.SecretVersion.fromObject(object.versions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SecretVolume message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {google.cloud.functions.v2.SecretVolume} message SecretVolume + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretVolume.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) { + object.mountPath = ""; + object.projectId = ""; + object.secret = ""; + } + if (message.mountPath != null && message.hasOwnProperty("mountPath")) + object.mountPath = message.mountPath; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.google.cloud.functions.v2.SecretVolume.SecretVersion.toObject(message.versions[j], options); + } + return object; + }; + + /** + * Converts this SecretVolume to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.SecretVolume + * @instance + * @returns {Object.} JSON object + */ + SecretVolume.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SecretVolume.SecretVersion = (function() { + + /** + * Properties of a SecretVersion. + * @memberof google.cloud.functions.v2.SecretVolume + * @interface ISecretVersion + * @property {string|null} [version] SecretVersion version + * @property {string|null} [path] SecretVersion path + */ + + /** + * Constructs a new SecretVersion. + * @memberof google.cloud.functions.v2.SecretVolume + * @classdesc Represents a SecretVersion. + * @implements ISecretVersion + * @constructor + * @param {google.cloud.functions.v2.SecretVolume.ISecretVersion=} [properties] Properties to set + */ + function SecretVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecretVersion version. + * @member {string} version + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.version = ""; + + /** + * SecretVersion path. + * @member {string} path + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @instance + */ + SecretVersion.prototype.path = ""; + + /** + * Creates a new SecretVersion instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2.SecretVolume.ISecretVersion=} [properties] Properties to set + * @returns {google.cloud.functions.v2.SecretVolume.SecretVersion} SecretVersion instance + */ + SecretVersion.create = function create(properties) { + return new SecretVersion(properties); + }; + + /** + * Encodes the specified SecretVersion message. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.SecretVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified SecretVersion message, length delimited. Does not implicitly {@link google.cloud.functions.v2.SecretVolume.SecretVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2.SecretVolume.ISecretVersion} message SecretVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecretVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.SecretVolume.SecretVersion} SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.SecretVolume.SecretVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.SecretVolume.SecretVersion} SecretVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecretVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecretVersion message. + * @function verify + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecretVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a SecretVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.SecretVolume.SecretVersion} SecretVersion + */ + SecretVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.SecretVolume.SecretVersion) + return object; + var message = new $root.google.cloud.functions.v2.SecretVolume.SecretVersion(); + if (object.version != null) + message.version = String(object.version); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a SecretVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v2.SecretVolume.SecretVersion} message SecretVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecretVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = ""; + object.path = ""; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this SecretVersion to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @instance + * @returns {Object.} JSON object + */ + SecretVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecretVersion; + })(); + + return SecretVolume; + })(); + + v2.EventTrigger = (function() { + + /** + * Properties of an EventTrigger. + * @memberof google.cloud.functions.v2 + * @interface IEventTrigger + * @property {string|null} [trigger] EventTrigger trigger + * @property {string|null} [triggerRegion] EventTrigger triggerRegion + * @property {string|null} [eventType] EventTrigger eventType + * @property {Array.|null} [eventFilters] EventTrigger eventFilters + * @property {string|null} [pubsubTopic] EventTrigger pubsubTopic + * @property {string|null} [serviceAccountEmail] EventTrigger serviceAccountEmail + * @property {google.cloud.functions.v2.EventTrigger.RetryPolicy|null} [retryPolicy] EventTrigger retryPolicy + * @property {string|null} [channel] EventTrigger channel + */ + + /** + * Constructs a new EventTrigger. + * @memberof google.cloud.functions.v2 + * @classdesc Represents an EventTrigger. + * @implements IEventTrigger + * @constructor + * @param {google.cloud.functions.v2.IEventTrigger=} [properties] Properties to set + */ + function EventTrigger(properties) { + this.eventFilters = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventTrigger trigger. + * @member {string} trigger + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.trigger = ""; + + /** + * EventTrigger triggerRegion. + * @member {string} triggerRegion + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.triggerRegion = ""; + + /** + * EventTrigger eventType. + * @member {string} eventType + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.eventType = ""; + + /** + * EventTrigger eventFilters. + * @member {Array.} eventFilters + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.eventFilters = $util.emptyArray; + + /** + * EventTrigger pubsubTopic. + * @member {string} pubsubTopic + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.pubsubTopic = ""; + + /** + * EventTrigger serviceAccountEmail. + * @member {string} serviceAccountEmail + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.serviceAccountEmail = ""; + + /** + * EventTrigger retryPolicy. + * @member {google.cloud.functions.v2.EventTrigger.RetryPolicy} retryPolicy + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.retryPolicy = 0; + + /** + * EventTrigger channel. + * @member {string} channel + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + */ + EventTrigger.prototype.channel = ""; + + /** + * Creates a new EventTrigger instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {google.cloud.functions.v2.IEventTrigger=} [properties] Properties to set + * @returns {google.cloud.functions.v2.EventTrigger} EventTrigger instance + */ + EventTrigger.create = function create(properties) { + return new EventTrigger(properties); + }; + + /** + * Encodes the specified EventTrigger message. Does not implicitly {@link google.cloud.functions.v2.EventTrigger.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {google.cloud.functions.v2.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.trigger); + if (message.triggerRegion != null && Object.hasOwnProperty.call(message, "triggerRegion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerRegion); + if (message.eventType != null && Object.hasOwnProperty.call(message, "eventType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.eventType); + if (message.eventFilters != null && message.eventFilters.length) + for (var i = 0; i < message.eventFilters.length; ++i) + $root.google.cloud.functions.v2.EventFilter.encode(message.eventFilters[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pubsubTopic != null && Object.hasOwnProperty.call(message, "pubsubTopic")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pubsubTopic); + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.serviceAccountEmail); + if (message.retryPolicy != null && Object.hasOwnProperty.call(message, "retryPolicy")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.retryPolicy); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.channel); + return writer; + }; + + /** + * Encodes the specified EventTrigger message, length delimited. Does not implicitly {@link google.cloud.functions.v2.EventTrigger.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {google.cloud.functions.v2.IEventTrigger} message EventTrigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventTrigger.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.EventTrigger(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.trigger = reader.string(); + break; + case 2: + message.triggerRegion = reader.string(); + break; + case 3: + message.eventType = reader.string(); + break; + case 4: + if (!(message.eventFilters && message.eventFilters.length)) + message.eventFilters = []; + message.eventFilters.push($root.google.cloud.functions.v2.EventFilter.decode(reader, reader.uint32())); + break; + case 5: + message.pubsubTopic = reader.string(); + break; + case 6: + message.serviceAccountEmail = reader.string(); + break; + case 7: + message.retryPolicy = reader.int32(); + break; + case 8: + message.channel = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventTrigger message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.EventTrigger} EventTrigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventTrigger.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventTrigger message. + * @function verify + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventTrigger.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) + if (!$util.isString(message.trigger)) + return "trigger: string expected"; + if (message.triggerRegion != null && message.hasOwnProperty("triggerRegion")) + if (!$util.isString(message.triggerRegion)) + return "triggerRegion: string expected"; + if (message.eventType != null && message.hasOwnProperty("eventType")) + if (!$util.isString(message.eventType)) + return "eventType: string expected"; + if (message.eventFilters != null && message.hasOwnProperty("eventFilters")) { + if (!Array.isArray(message.eventFilters)) + return "eventFilters: array expected"; + for (var i = 0; i < message.eventFilters.length; ++i) { + var error = $root.google.cloud.functions.v2.EventFilter.verify(message.eventFilters[i]); + if (error) + return "eventFilters." + error; + } + } + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) + if (!$util.isString(message.pubsubTopic)) + return "pubsubTopic: string expected"; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (!$util.isString(message.serviceAccountEmail)) + return "serviceAccountEmail: string expected"; + if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) + switch (message.retryPolicy) { + default: + return "retryPolicy: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.channel != null && message.hasOwnProperty("channel")) + if (!$util.isString(message.channel)) + return "channel: string expected"; + return null; + }; + + /** + * Creates an EventTrigger message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.EventTrigger} EventTrigger + */ + EventTrigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.EventTrigger) + return object; + var message = new $root.google.cloud.functions.v2.EventTrigger(); + if (object.trigger != null) + message.trigger = String(object.trigger); + if (object.triggerRegion != null) + message.triggerRegion = String(object.triggerRegion); + if (object.eventType != null) + message.eventType = String(object.eventType); + if (object.eventFilters) { + if (!Array.isArray(object.eventFilters)) + throw TypeError(".google.cloud.functions.v2.EventTrigger.eventFilters: array expected"); + message.eventFilters = []; + for (var i = 0; i < object.eventFilters.length; ++i) { + if (typeof object.eventFilters[i] !== "object") + throw TypeError(".google.cloud.functions.v2.EventTrigger.eventFilters: object expected"); + message.eventFilters[i] = $root.google.cloud.functions.v2.EventFilter.fromObject(object.eventFilters[i]); + } + } + if (object.pubsubTopic != null) + message.pubsubTopic = String(object.pubsubTopic); + if (object.serviceAccountEmail != null) + message.serviceAccountEmail = String(object.serviceAccountEmail); + switch (object.retryPolicy) { + case "RETRY_POLICY_UNSPECIFIED": + case 0: + message.retryPolicy = 0; + break; + case "RETRY_POLICY_DO_NOT_RETRY": + case 1: + message.retryPolicy = 1; + break; + case "RETRY_POLICY_RETRY": + case 2: + message.retryPolicy = 2; + break; + } + if (object.channel != null) + message.channel = String(object.channel); + return message; + }; + + /** + * Creates a plain object from an EventTrigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {google.cloud.functions.v2.EventTrigger} message EventTrigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventTrigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.eventFilters = []; + if (options.defaults) { + object.trigger = ""; + object.triggerRegion = ""; + object.eventType = ""; + object.pubsubTopic = ""; + object.serviceAccountEmail = ""; + object.retryPolicy = options.enums === String ? "RETRY_POLICY_UNSPECIFIED" : 0; + object.channel = ""; + } + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = message.trigger; + if (message.triggerRegion != null && message.hasOwnProperty("triggerRegion")) + object.triggerRegion = message.triggerRegion; + if (message.eventType != null && message.hasOwnProperty("eventType")) + object.eventType = message.eventType; + if (message.eventFilters && message.eventFilters.length) { + object.eventFilters = []; + for (var j = 0; j < message.eventFilters.length; ++j) + object.eventFilters[j] = $root.google.cloud.functions.v2.EventFilter.toObject(message.eventFilters[j], options); + } + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) + object.pubsubTopic = message.pubsubTopic; + if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + object.serviceAccountEmail = message.serviceAccountEmail; + if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) + object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = message.channel; + return object; + }; + + /** + * Converts this EventTrigger to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.EventTrigger + * @instance + * @returns {Object.} JSON object + */ + EventTrigger.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * RetryPolicy enum. + * @name google.cloud.functions.v2.EventTrigger.RetryPolicy + * @enum {number} + * @property {number} RETRY_POLICY_UNSPECIFIED=0 RETRY_POLICY_UNSPECIFIED value + * @property {number} RETRY_POLICY_DO_NOT_RETRY=1 RETRY_POLICY_DO_NOT_RETRY value + * @property {number} RETRY_POLICY_RETRY=2 RETRY_POLICY_RETRY value + */ + EventTrigger.RetryPolicy = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETRY_POLICY_UNSPECIFIED"] = 0; + values[valuesById[1] = "RETRY_POLICY_DO_NOT_RETRY"] = 1; + values[valuesById[2] = "RETRY_POLICY_RETRY"] = 2; + return values; + })(); + + return EventTrigger; + })(); + + v2.EventFilter = (function() { + + /** + * Properties of an EventFilter. + * @memberof google.cloud.functions.v2 + * @interface IEventFilter + * @property {string|null} [attribute] EventFilter attribute + * @property {string|null} [value] EventFilter value + * @property {string|null} [operator] EventFilter operator + */ + + /** + * Constructs a new EventFilter. + * @memberof google.cloud.functions.v2 + * @classdesc Represents an EventFilter. + * @implements IEventFilter + * @constructor + * @param {google.cloud.functions.v2.IEventFilter=} [properties] Properties to set + */ + function EventFilter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventFilter attribute. + * @member {string} attribute + * @memberof google.cloud.functions.v2.EventFilter + * @instance + */ + EventFilter.prototype.attribute = ""; + + /** + * EventFilter value. + * @member {string} value + * @memberof google.cloud.functions.v2.EventFilter + * @instance + */ + EventFilter.prototype.value = ""; + + /** + * EventFilter operator. + * @member {string} operator + * @memberof google.cloud.functions.v2.EventFilter + * @instance + */ + EventFilter.prototype.operator = ""; + + /** + * Creates a new EventFilter instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {google.cloud.functions.v2.IEventFilter=} [properties] Properties to set + * @returns {google.cloud.functions.v2.EventFilter} EventFilter instance + */ + EventFilter.create = function create(properties) { + return new EventFilter(properties); + }; + + /** + * Encodes the specified EventFilter message. Does not implicitly {@link google.cloud.functions.v2.EventFilter.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {google.cloud.functions.v2.IEventFilter} message EventFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventFilter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.attribute != null && Object.hasOwnProperty.call(message, "attribute")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.attribute); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.operator != null && Object.hasOwnProperty.call(message, "operator")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.operator); + return writer; + }; + + /** + * Encodes the specified EventFilter message, length delimited. Does not implicitly {@link google.cloud.functions.v2.EventFilter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {google.cloud.functions.v2.IEventFilter} message EventFilter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventFilter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventFilter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.EventFilter} EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventFilter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.EventFilter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.attribute = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + case 3: + message.operator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventFilter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.EventFilter} EventFilter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventFilter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventFilter message. + * @function verify + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventFilter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.attribute != null && message.hasOwnProperty("attribute")) + if (!$util.isString(message.attribute)) + return "attribute: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.operator != null && message.hasOwnProperty("operator")) + if (!$util.isString(message.operator)) + return "operator: string expected"; + return null; + }; + + /** + * Creates an EventFilter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.EventFilter} EventFilter + */ + EventFilter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.EventFilter) + return object; + var message = new $root.google.cloud.functions.v2.EventFilter(); + if (object.attribute != null) + message.attribute = String(object.attribute); + if (object.value != null) + message.value = String(object.value); + if (object.operator != null) + message.operator = String(object.operator); + return message; + }; + + /** + * Creates a plain object from an EventFilter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {google.cloud.functions.v2.EventFilter} message EventFilter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventFilter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.attribute = ""; + object.value = ""; + object.operator = ""; + } + if (message.attribute != null && message.hasOwnProperty("attribute")) + object.attribute = message.attribute; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.operator != null && message.hasOwnProperty("operator")) + object.operator = message.operator; + return object; + }; + + /** + * Converts this EventFilter to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.EventFilter + * @instance + * @returns {Object.} JSON object + */ + EventFilter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventFilter; + })(); + + v2.GetFunctionRequest = (function() { + + /** + * Properties of a GetFunctionRequest. + * @memberof google.cloud.functions.v2 + * @interface IGetFunctionRequest + * @property {string|null} [name] GetFunctionRequest name + */ + + /** + * Constructs a new GetFunctionRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GetFunctionRequest. + * @implements IGetFunctionRequest + * @constructor + * @param {google.cloud.functions.v2.IGetFunctionRequest=} [properties] Properties to set + */ + function GetFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @instance + */ + GetFunctionRequest.prototype.name = ""; + + /** + * Creates a new GetFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2.IGetFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GetFunctionRequest} GetFunctionRequest instance + */ + GetFunctionRequest.create = function create(properties) { + return new GetFunctionRequest(properties); + }; + + /** + * Encodes the specified GetFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.GetFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GetFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2.IGetFunctionRequest} message GetFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GetFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GetFunctionRequest} GetFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GetFunctionRequest} GetFunctionRequest + */ + GetFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GetFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2.GetFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {google.cloud.functions.v2.GetFunctionRequest} message GetFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + GetFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetFunctionRequest; + })(); + + v2.ListFunctionsRequest = (function() { + + /** + * Properties of a ListFunctionsRequest. + * @memberof google.cloud.functions.v2 + * @interface IListFunctionsRequest + * @property {string|null} [parent] ListFunctionsRequest parent + * @property {number|null} [pageSize] ListFunctionsRequest pageSize + * @property {string|null} [pageToken] ListFunctionsRequest pageToken + * @property {string|null} [filter] ListFunctionsRequest filter + * @property {string|null} [orderBy] ListFunctionsRequest orderBy + */ + + /** + * Constructs a new ListFunctionsRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ListFunctionsRequest. + * @implements IListFunctionsRequest + * @constructor + * @param {google.cloud.functions.v2.IListFunctionsRequest=} [properties] Properties to set + */ + function ListFunctionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFunctionsRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.parent = ""; + + /** + * ListFunctionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageSize = 0; + + /** + * ListFunctionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.pageToken = ""; + + /** + * ListFunctionsRequest filter. + * @member {string} filter + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.filter = ""; + + /** + * ListFunctionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + */ + ListFunctionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListFunctionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2.IListFunctionsRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListFunctionsRequest} ListFunctionsRequest instance + */ + ListFunctionsRequest.create = function create(properties) { + return new ListFunctionsRequest(properties); + }; + + /** + * Encodes the specified ListFunctionsRequest message. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListFunctionsRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2.IListFunctionsRequest} message ListFunctionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListFunctionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.filter = reader.string(); + break; + case 5: + message.orderBy = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListFunctionsRequest} ListFunctionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsRequest message. + * @function verify + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListFunctionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListFunctionsRequest} ListFunctionsRequest + */ + ListFunctionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListFunctionsRequest) + return object; + var message = new $root.google.cloud.functions.v2.ListFunctionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListFunctionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {google.cloud.functions.v2.ListFunctionsRequest} message ListFunctionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListFunctionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsRequest; + })(); + + v2.ListFunctionsResponse = (function() { + + /** + * Properties of a ListFunctionsResponse. + * @memberof google.cloud.functions.v2 + * @interface IListFunctionsResponse + * @property {Array.|null} [functions] ListFunctionsResponse functions + * @property {string|null} [nextPageToken] ListFunctionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListFunctionsResponse unreachable + */ + + /** + * Constructs a new ListFunctionsResponse. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ListFunctionsResponse. + * @implements IListFunctionsResponse + * @constructor + * @param {google.cloud.functions.v2.IListFunctionsResponse=} [properties] Properties to set + */ + function ListFunctionsResponse(properties) { + this.functions = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListFunctionsResponse functions. + * @member {Array.} functions + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.functions = $util.emptyArray; + + /** + * ListFunctionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.nextPageToken = ""; + + /** + * ListFunctionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @instance + */ + ListFunctionsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListFunctionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2.IListFunctionsResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListFunctionsResponse} ListFunctionsResponse instance + */ + ListFunctionsResponse.create = function create(properties) { + return new ListFunctionsResponse(properties); + }; + + /** + * Encodes the specified ListFunctionsResponse message. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.functions != null && message.functions.length) + for (var i = 0; i < message.functions.length; ++i) + $root.google.cloud.functions.v2.Function.encode(message.functions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListFunctionsResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListFunctionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2.IListFunctionsResponse} message ListFunctionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFunctionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListFunctionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v2.Function.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFunctionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListFunctionsResponse} ListFunctionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFunctionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFunctionsResponse message. + * @function verify + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFunctionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.functions != null && message.hasOwnProperty("functions")) { + if (!Array.isArray(message.functions)) + return "functions: array expected"; + for (var i = 0; i < message.functions.length; ++i) { + var error = $root.google.cloud.functions.v2.Function.verify(message.functions[i]); + if (error) + return "functions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListFunctionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListFunctionsResponse} ListFunctionsResponse + */ + ListFunctionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListFunctionsResponse) + return object; + var message = new $root.google.cloud.functions.v2.ListFunctionsResponse(); + if (object.functions) { + if (!Array.isArray(object.functions)) + throw TypeError(".google.cloud.functions.v2.ListFunctionsResponse.functions: array expected"); + message.functions = []; + for (var i = 0; i < object.functions.length; ++i) { + if (typeof object.functions[i] !== "object") + throw TypeError(".google.cloud.functions.v2.ListFunctionsResponse.functions: object expected"); + message.functions[i] = $root.google.cloud.functions.v2.Function.fromObject(object.functions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.functions.v2.ListFunctionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListFunctionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {google.cloud.functions.v2.ListFunctionsResponse} message ListFunctionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFunctionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.functions = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.functions && message.functions.length) { + object.functions = []; + for (var j = 0; j < message.functions.length; ++j) + object.functions[j] = $root.google.cloud.functions.v2.Function.toObject(message.functions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListFunctionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListFunctionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFunctionsResponse; + })(); + + v2.CreateFunctionRequest = (function() { + + /** + * Properties of a CreateFunctionRequest. + * @memberof google.cloud.functions.v2 + * @interface ICreateFunctionRequest + * @property {string|null} [parent] CreateFunctionRequest parent + * @property {google.cloud.functions.v2.IFunction|null} ["function"] CreateFunctionRequest function + * @property {string|null} [functionId] CreateFunctionRequest functionId + */ + + /** + * Constructs a new CreateFunctionRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a CreateFunctionRequest. + * @implements ICreateFunctionRequest + * @constructor + * @param {google.cloud.functions.v2.ICreateFunctionRequest=} [properties] Properties to set + */ + function CreateFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateFunctionRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.parent = ""; + + /** + * CreateFunctionRequest function. + * @member {google.cloud.functions.v2.IFunction|null|undefined} function + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype["function"] = null; + + /** + * CreateFunctionRequest functionId. + * @member {string} functionId + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @instance + */ + CreateFunctionRequest.prototype.functionId = ""; + + /** + * Creates a new CreateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2.ICreateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.CreateFunctionRequest} CreateFunctionRequest instance + */ + CreateFunctionRequest.create = function create(properties) { + return new CreateFunctionRequest(properties); + }; + + /** + * Encodes the specified CreateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.CreateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v2.Function.encode(message["function"], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.functionId != null && Object.hasOwnProperty.call(message, "functionId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.functionId); + return writer; + }; + + /** + * Encodes the specified CreateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.CreateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2.ICreateFunctionRequest} message CreateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.CreateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message["function"] = $root.google.cloud.functions.v2.Function.decode(reader, reader.uint32()); + break; + case 3: + message.functionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.CreateFunctionRequest} CreateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v2.Function.verify(message["function"]); + if (error) + return "function." + error; + } + if (message.functionId != null && message.hasOwnProperty("functionId")) + if (!$util.isString(message.functionId)) + return "functionId: string expected"; + return null; + }; + + /** + * Creates a CreateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.CreateFunctionRequest} CreateFunctionRequest + */ + CreateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.CreateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2.CreateFunctionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v2.CreateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v2.Function.fromObject(object["function"]); + } + if (object.functionId != null) + message.functionId = String(object.functionId); + return message; + }; + + /** + * Creates a plain object from a CreateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {google.cloud.functions.v2.CreateFunctionRequest} message CreateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object["function"] = null; + object.functionId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v2.Function.toObject(message["function"], options); + if (message.functionId != null && message.hasOwnProperty("functionId")) + object.functionId = message.functionId; + return object; + }; + + /** + * Converts this CreateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateFunctionRequest; + })(); + + v2.UpdateFunctionRequest = (function() { + + /** + * Properties of an UpdateFunctionRequest. + * @memberof google.cloud.functions.v2 + * @interface IUpdateFunctionRequest + * @property {google.cloud.functions.v2.IFunction|null} ["function"] UpdateFunctionRequest function + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFunctionRequest updateMask + */ + + /** + * Constructs a new UpdateFunctionRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents an UpdateFunctionRequest. + * @implements IUpdateFunctionRequest + * @constructor + * @param {google.cloud.functions.v2.IUpdateFunctionRequest=} [properties] Properties to set + */ + function UpdateFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateFunctionRequest function. + * @member {google.cloud.functions.v2.IFunction|null|undefined} function + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype["function"] = null; + + /** + * UpdateFunctionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @instance + */ + UpdateFunctionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2.IUpdateFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.UpdateFunctionRequest} UpdateFunctionRequest instance + */ + UpdateFunctionRequest.create = function create(properties) { + return new UpdateFunctionRequest(properties); + }; + + /** + * Encodes the specified UpdateFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.UpdateFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + $root.google.cloud.functions.v2.Function.encode(message["function"], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.UpdateFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2.IUpdateFunctionRequest} message UpdateFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.UpdateFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["function"] = $root.google.cloud.functions.v2.Function.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.UpdateFunctionRequest} UpdateFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message["function"] != null && message.hasOwnProperty("function")) { + var error = $root.google.cloud.functions.v2.Function.verify(message["function"]); + if (error) + return "function." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.UpdateFunctionRequest} UpdateFunctionRequest + */ + UpdateFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.UpdateFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2.UpdateFunctionRequest(); + if (object["function"] != null) { + if (typeof object["function"] !== "object") + throw TypeError(".google.cloud.functions.v2.UpdateFunctionRequest.function: object expected"); + message["function"] = $root.google.cloud.functions.v2.Function.fromObject(object["function"]); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.functions.v2.UpdateFunctionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {google.cloud.functions.v2.UpdateFunctionRequest} message UpdateFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object["function"] = null; + object.updateMask = null; + } + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = $root.google.cloud.functions.v2.Function.toObject(message["function"], options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateFunctionRequest; + })(); + + v2.DeleteFunctionRequest = (function() { + + /** + * Properties of a DeleteFunctionRequest. + * @memberof google.cloud.functions.v2 + * @interface IDeleteFunctionRequest + * @property {string|null} [name] DeleteFunctionRequest name + */ + + /** + * Constructs a new DeleteFunctionRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a DeleteFunctionRequest. + * @implements IDeleteFunctionRequest + * @constructor + * @param {google.cloud.functions.v2.IDeleteFunctionRequest=} [properties] Properties to set + */ + function DeleteFunctionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteFunctionRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @instance + */ + DeleteFunctionRequest.prototype.name = ""; + + /** + * Creates a new DeleteFunctionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2.IDeleteFunctionRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.DeleteFunctionRequest} DeleteFunctionRequest instance + */ + DeleteFunctionRequest.create = function create(properties) { + return new DeleteFunctionRequest(properties); + }; + + /** + * Encodes the specified DeleteFunctionRequest message. Does not implicitly {@link google.cloud.functions.v2.DeleteFunctionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteFunctionRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.DeleteFunctionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2.IDeleteFunctionRequest} message DeleteFunctionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFunctionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.DeleteFunctionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteFunctionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.DeleteFunctionRequest} DeleteFunctionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFunctionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteFunctionRequest message. + * @function verify + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteFunctionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteFunctionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.DeleteFunctionRequest} DeleteFunctionRequest + */ + DeleteFunctionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.DeleteFunctionRequest) + return object; + var message = new $root.google.cloud.functions.v2.DeleteFunctionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteFunctionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {google.cloud.functions.v2.DeleteFunctionRequest} message DeleteFunctionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteFunctionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteFunctionRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteFunctionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteFunctionRequest; + })(); + + v2.GenerateUploadUrlRequest = (function() { + + /** + * Properties of a GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v2 + * @interface IGenerateUploadUrlRequest + * @property {string|null} [parent] GenerateUploadUrlRequest parent + */ + + /** + * Constructs a new GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GenerateUploadUrlRequest. + * @implements IGenerateUploadUrlRequest + * @constructor + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest=} [properties] Properties to set + */ + function GenerateUploadUrlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateUploadUrlRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @instance + */ + GenerateUploadUrlRequest.prototype.parent = ""; + + /** + * Creates a new GenerateUploadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GenerateUploadUrlRequest} GenerateUploadUrlRequest instance + */ + GenerateUploadUrlRequest.create = function create(properties) { + return new GenerateUploadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlRequest} message GenerateUploadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GenerateUploadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GenerateUploadUrlRequest} GenerateUploadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + return null; + }; + + /** + * Creates a GenerateUploadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GenerateUploadUrlRequest} GenerateUploadUrlRequest + */ + GenerateUploadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GenerateUploadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v2.GenerateUploadUrlRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {google.cloud.functions.v2.GenerateUploadUrlRequest} message GenerateUploadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GenerateUploadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlRequest; + })(); + + v2.GenerateUploadUrlResponse = (function() { + + /** + * Properties of a GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v2 + * @interface IGenerateUploadUrlResponse + * @property {string|null} [uploadUrl] GenerateUploadUrlResponse uploadUrl + * @property {google.cloud.functions.v2.IStorageSource|null} [storageSource] GenerateUploadUrlResponse storageSource + */ + + /** + * Constructs a new GenerateUploadUrlResponse. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GenerateUploadUrlResponse. + * @implements IGenerateUploadUrlResponse + * @constructor + * @param {google.cloud.functions.v2.IGenerateUploadUrlResponse=} [properties] Properties to set + */ + function GenerateUploadUrlResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateUploadUrlResponse uploadUrl. + * @member {string} uploadUrl + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.uploadUrl = ""; + + /** + * GenerateUploadUrlResponse storageSource. + * @member {google.cloud.functions.v2.IStorageSource|null|undefined} storageSource + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @instance + */ + GenerateUploadUrlResponse.prototype.storageSource = null; + + /** + * Creates a new GenerateUploadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GenerateUploadUrlResponse} GenerateUploadUrlResponse instance + */ + GenerateUploadUrlResponse.create = function create(properties) { + return new GenerateUploadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uploadUrl != null && Object.hasOwnProperty.call(message, "uploadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uploadUrl); + if (message.storageSource != null && Object.hasOwnProperty.call(message, "storageSource")) + $root.google.cloud.functions.v2.StorageSource.encode(message.storageSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateUploadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateUploadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateUploadUrlResponse} message GenerateUploadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateUploadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GenerateUploadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uploadUrl = reader.string(); + break; + case 2: + message.storageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateUploadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GenerateUploadUrlResponse} GenerateUploadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateUploadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateUploadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateUploadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + if (!$util.isString(message.uploadUrl)) + return "uploadUrl: string expected"; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) { + var error = $root.google.cloud.functions.v2.StorageSource.verify(message.storageSource); + if (error) + return "storageSource." + error; + } + return null; + }; + + /** + * Creates a GenerateUploadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GenerateUploadUrlResponse} GenerateUploadUrlResponse + */ + GenerateUploadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GenerateUploadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v2.GenerateUploadUrlResponse(); + if (object.uploadUrl != null) + message.uploadUrl = String(object.uploadUrl); + if (object.storageSource != null) { + if (typeof object.storageSource !== "object") + throw TypeError(".google.cloud.functions.v2.GenerateUploadUrlResponse.storageSource: object expected"); + message.storageSource = $root.google.cloud.functions.v2.StorageSource.fromObject(object.storageSource); + } + return message; + }; + + /** + * Creates a plain object from a GenerateUploadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {google.cloud.functions.v2.GenerateUploadUrlResponse} message GenerateUploadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateUploadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uploadUrl = ""; + object.storageSource = null; + } + if (message.uploadUrl != null && message.hasOwnProperty("uploadUrl")) + object.uploadUrl = message.uploadUrl; + if (message.storageSource != null && message.hasOwnProperty("storageSource")) + object.storageSource = $root.google.cloud.functions.v2.StorageSource.toObject(message.storageSource, options); + return object; + }; + + /** + * Converts this GenerateUploadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateUploadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateUploadUrlResponse; + })(); + + v2.GenerateDownloadUrlRequest = (function() { + + /** + * Properties of a GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v2 + * @interface IGenerateDownloadUrlRequest + * @property {string|null} [name] GenerateDownloadUrlRequest name + */ + + /** + * Constructs a new GenerateDownloadUrlRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GenerateDownloadUrlRequest. + * @implements IGenerateDownloadUrlRequest + * @constructor + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest=} [properties] Properties to set + */ + function GenerateDownloadUrlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateDownloadUrlRequest name. + * @member {string} name + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @instance + */ + GenerateDownloadUrlRequest.prototype.name = ""; + + /** + * Creates a new GenerateDownloadUrlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest instance + */ + GenerateDownloadUrlRequest.create = function create(properties) { + return new GenerateDownloadUrlRequest(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlRequest} message GenerateDownloadUrlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GenerateDownloadUrlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlRequest message. + * @function verify + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GenerateDownloadUrlRequest} GenerateDownloadUrlRequest + */ + GenerateDownloadUrlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GenerateDownloadUrlRequest) + return object; + var message = new $root.google.cloud.functions.v2.GenerateDownloadUrlRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {google.cloud.functions.v2.GenerateDownloadUrlRequest} message GenerateDownloadUrlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GenerateDownloadUrlRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlRequest; + })(); + + v2.GenerateDownloadUrlResponse = (function() { + + /** + * Properties of a GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v2 + * @interface IGenerateDownloadUrlResponse + * @property {string|null} [downloadUrl] GenerateDownloadUrlResponse downloadUrl + */ + + /** + * Constructs a new GenerateDownloadUrlResponse. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a GenerateDownloadUrlResponse. + * @implements IGenerateDownloadUrlResponse + * @constructor + * @param {google.cloud.functions.v2.IGenerateDownloadUrlResponse=} [properties] Properties to set + */ + function GenerateDownloadUrlResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateDownloadUrlResponse downloadUrl. + * @member {string} downloadUrl + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @instance + */ + GenerateDownloadUrlResponse.prototype.downloadUrl = ""; + + /** + * Creates a new GenerateDownloadUrlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse instance + */ + GenerateDownloadUrlResponse.create = function create(properties) { + return new GenerateDownloadUrlResponse(properties); + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.downloadUrl != null && Object.hasOwnProperty.call(message, "downloadUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.downloadUrl); + return writer; + }; + + /** + * Encodes the specified GenerateDownloadUrlResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.GenerateDownloadUrlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2.IGenerateDownloadUrlResponse} message GenerateDownloadUrlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateDownloadUrlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.GenerateDownloadUrlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.downloadUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateDownloadUrlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateDownloadUrlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateDownloadUrlResponse message. + * @function verify + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateDownloadUrlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + if (!$util.isString(message.downloadUrl)) + return "downloadUrl: string expected"; + return null; + }; + + /** + * Creates a GenerateDownloadUrlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.GenerateDownloadUrlResponse} GenerateDownloadUrlResponse + */ + GenerateDownloadUrlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.GenerateDownloadUrlResponse) + return object; + var message = new $root.google.cloud.functions.v2.GenerateDownloadUrlResponse(); + if (object.downloadUrl != null) + message.downloadUrl = String(object.downloadUrl); + return message; + }; + + /** + * Creates a plain object from a GenerateDownloadUrlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {google.cloud.functions.v2.GenerateDownloadUrlResponse} message GenerateDownloadUrlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateDownloadUrlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.downloadUrl = ""; + if (message.downloadUrl != null && message.hasOwnProperty("downloadUrl")) + object.downloadUrl = message.downloadUrl; + return object; + }; + + /** + * Converts this GenerateDownloadUrlResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateDownloadUrlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenerateDownloadUrlResponse; + })(); + + v2.ListRuntimesRequest = (function() { + + /** + * Properties of a ListRuntimesRequest. + * @memberof google.cloud.functions.v2 + * @interface IListRuntimesRequest + * @property {string|null} [parent] ListRuntimesRequest parent + * @property {string|null} [filter] ListRuntimesRequest filter + */ + + /** + * Constructs a new ListRuntimesRequest. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ListRuntimesRequest. + * @implements IListRuntimesRequest + * @constructor + * @param {google.cloud.functions.v2.IListRuntimesRequest=} [properties] Properties to set + */ + function ListRuntimesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRuntimesRequest parent. + * @member {string} parent + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @instance + */ + ListRuntimesRequest.prototype.parent = ""; + + /** + * ListRuntimesRequest filter. + * @member {string} filter + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @instance + */ + ListRuntimesRequest.prototype.filter = ""; + + /** + * Creates a new ListRuntimesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2.IListRuntimesRequest=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListRuntimesRequest} ListRuntimesRequest instance + */ + ListRuntimesRequest.create = function create(properties) { + return new ListRuntimesRequest(properties); + }; + + /** + * Encodes the specified ListRuntimesRequest message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2.IListRuntimesRequest} message ListRuntimesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListRuntimesRequest message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2.IListRuntimesRequest} message ListRuntimesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListRuntimesRequest} ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListRuntimesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListRuntimesRequest} ListRuntimesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimesRequest message. + * @function verify + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListRuntimesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListRuntimesRequest} ListRuntimesRequest + */ + ListRuntimesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListRuntimesRequest) + return object; + var message = new $root.google.cloud.functions.v2.ListRuntimesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListRuntimesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {google.cloud.functions.v2.ListRuntimesRequest} message ListRuntimesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListRuntimesRequest to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @instance + * @returns {Object.} JSON object + */ + ListRuntimesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListRuntimesRequest; + })(); + + v2.ListRuntimesResponse = (function() { + + /** + * Properties of a ListRuntimesResponse. + * @memberof google.cloud.functions.v2 + * @interface IListRuntimesResponse + * @property {Array.|null} [runtimes] ListRuntimesResponse runtimes + */ + + /** + * Constructs a new ListRuntimesResponse. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a ListRuntimesResponse. + * @implements IListRuntimesResponse + * @constructor + * @param {google.cloud.functions.v2.IListRuntimesResponse=} [properties] Properties to set + */ + function ListRuntimesResponse(properties) { + this.runtimes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRuntimesResponse runtimes. + * @member {Array.} runtimes + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @instance + */ + ListRuntimesResponse.prototype.runtimes = $util.emptyArray; + + /** + * Creates a new ListRuntimesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2.IListRuntimesResponse=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListRuntimesResponse} ListRuntimesResponse instance + */ + ListRuntimesResponse.create = function create(properties) { + return new ListRuntimesResponse(properties); + }; + + /** + * Encodes the specified ListRuntimesResponse message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2.IListRuntimesResponse} message ListRuntimesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.runtimes != null && message.runtimes.length) + for (var i = 0; i < message.runtimes.length; ++i) + $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.encode(message.runtimes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListRuntimesResponse message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2.IListRuntimesResponse} message ListRuntimesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRuntimesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListRuntimesResponse} ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListRuntimesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.runtimes && message.runtimes.length)) + message.runtimes = []; + message.runtimes.push($root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRuntimesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListRuntimesResponse} ListRuntimesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRuntimesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRuntimesResponse message. + * @function verify + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRuntimesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.runtimes != null && message.hasOwnProperty("runtimes")) { + if (!Array.isArray(message.runtimes)) + return "runtimes: array expected"; + for (var i = 0; i < message.runtimes.length; ++i) { + var error = $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify(message.runtimes[i]); + if (error) + return "runtimes." + error; + } + } + return null; + }; + + /** + * Creates a ListRuntimesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListRuntimesResponse} ListRuntimesResponse + */ + ListRuntimesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListRuntimesResponse) + return object; + var message = new $root.google.cloud.functions.v2.ListRuntimesResponse(); + if (object.runtimes) { + if (!Array.isArray(object.runtimes)) + throw TypeError(".google.cloud.functions.v2.ListRuntimesResponse.runtimes: array expected"); + message.runtimes = []; + for (var i = 0; i < object.runtimes.length; ++i) { + if (typeof object.runtimes[i] !== "object") + throw TypeError(".google.cloud.functions.v2.ListRuntimesResponse.runtimes: object expected"); + message.runtimes[i] = $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.fromObject(object.runtimes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListRuntimesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse} message ListRuntimesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRuntimesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.runtimes = []; + if (message.runtimes && message.runtimes.length) { + object.runtimes = []; + for (var j = 0; j < message.runtimes.length; ++j) + object.runtimes[j] = $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.toObject(message.runtimes[j], options); + } + return object; + }; + + /** + * Converts this ListRuntimesResponse to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @instance + * @returns {Object.} JSON object + */ + ListRuntimesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ListRuntimesResponse.Runtime = (function() { + + /** + * Properties of a Runtime. + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @interface IRuntime + * @property {string|null} [name] Runtime name + * @property {string|null} [displayName] Runtime displayName + * @property {google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage|null} [stage] Runtime stage + * @property {Array.|null} [warnings] Runtime warnings + * @property {google.cloud.functions.v2.Environment|null} [environment] Runtime environment + */ + + /** + * Constructs a new Runtime. + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @classdesc Represents a Runtime. + * @implements IRuntime + * @constructor + * @param {google.cloud.functions.v2.ListRuntimesResponse.IRuntime=} [properties] Properties to set + */ + function Runtime(properties) { + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Runtime name. + * @member {string} name + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.name = ""; + + /** + * Runtime displayName. + * @member {string} displayName + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.displayName = ""; + + /** + * Runtime stage. + * @member {google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage} stage + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.stage = 0; + + /** + * Runtime warnings. + * @member {Array.} warnings + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.warnings = $util.emptyArray; + + /** + * Runtime environment. + * @member {google.cloud.functions.v2.Environment} environment + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + */ + Runtime.prototype.environment = 0; + + /** + * Creates a new Runtime instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse.IRuntime=} [properties] Properties to set + * @returns {google.cloud.functions.v2.ListRuntimesResponse.Runtime} Runtime instance + */ + Runtime.create = function create(properties) { + return new Runtime(properties); + }; + + /** + * Encodes the specified Runtime message. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse.IRuntime} message Runtime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Runtime.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.stage != null && Object.hasOwnProperty.call(message, "stage")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.stage); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.warnings[i]); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.environment); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.displayName); + return writer; + }; + + /** + * Encodes the specified Runtime message, length delimited. Does not implicitly {@link google.cloud.functions.v2.ListRuntimesResponse.Runtime.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse.IRuntime} message Runtime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Runtime.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Runtime message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.ListRuntimesResponse.Runtime} Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Runtime.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 5: + message.displayName = reader.string(); + break; + case 2: + message.stage = reader.int32(); + break; + case 3: + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push(reader.string()); + break; + case 4: + message.environment = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Runtime message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.ListRuntimesResponse.Runtime} Runtime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Runtime.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Runtime message. + * @function verify + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Runtime.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.stage != null && message.hasOwnProperty("stage")) + switch (message.stage) { + default: + return "stage: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) + if (!$util.isString(message.warnings[i])) + return "warnings: string[] expected"; + } + if (message.environment != null && message.hasOwnProperty("environment")) + switch (message.environment) { + default: + return "environment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a Runtime message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.ListRuntimesResponse.Runtime} Runtime + */ + Runtime.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime) + return object; + var message = new $root.google.cloud.functions.v2.ListRuntimesResponse.Runtime(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.stage) { + case "RUNTIME_STAGE_UNSPECIFIED": + case 0: + message.stage = 0; + break; + case "DEVELOPMENT": + case 1: + message.stage = 1; + break; + case "ALPHA": + case 2: + message.stage = 2; + break; + case "BETA": + case 3: + message.stage = 3; + break; + case "GA": + case 4: + message.stage = 4; + break; + case "DEPRECATED": + case 5: + message.stage = 5; + break; + case "DECOMMISSIONED": + case 6: + message.stage = 6; + break; + } + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.functions.v2.ListRuntimesResponse.Runtime.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) + message.warnings[i] = String(object.warnings[i]); + } + switch (object.environment) { + case "ENVIRONMENT_UNSPECIFIED": + case 0: + message.environment = 0; + break; + case "GEN_1": + case 1: + message.environment = 1; + break; + case "GEN_2": + case 2: + message.environment = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a Runtime message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {google.cloud.functions.v2.ListRuntimesResponse.Runtime} message Runtime + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Runtime.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.warnings = []; + if (options.defaults) { + object.name = ""; + object.stage = options.enums === String ? "RUNTIME_STAGE_UNSPECIFIED" : 0; + object.environment = options.enums === String ? "ENVIRONMENT_UNSPECIFIED" : 0; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.stage != null && message.hasOwnProperty("stage")) + object.stage = options.enums === String ? $root.google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = message.warnings[j]; + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = options.enums === String ? $root.google.cloud.functions.v2.Environment[message.environment] : message.environment; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + return object; + }; + + /** + * Converts this Runtime to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @instance + * @returns {Object.} JSON object + */ + Runtime.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Runtime; + })(); + + /** + * RuntimeStage enum. + * @name google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage + * @enum {number} + * @property {number} RUNTIME_STAGE_UNSPECIFIED=0 RUNTIME_STAGE_UNSPECIFIED value + * @property {number} DEVELOPMENT=1 DEVELOPMENT value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + * @property {number} DECOMMISSIONED=6 DECOMMISSIONED value + */ + ListRuntimesResponse.RuntimeStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RUNTIME_STAGE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DEVELOPMENT"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + values[valuesById[6] = "DECOMMISSIONED"] = 6; + return values; + })(); + + return ListRuntimesResponse; + })(); + + v2.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.functions.v2 + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [statusDetail] OperationMetadata statusDetail + * @property {boolean|null} [cancelRequested] OperationMetadata cancelRequested + * @property {string|null} [apiVersion] OperationMetadata apiVersion + * @property {google.protobuf.IAny|null} [requestResource] OperationMetadata requestResource + * @property {Array.|null} [stages] OperationMetadata stages + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.functions.v2 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.functions.v2.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(properties) { + this.stages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata statusDetail. + * @member {string} statusDetail + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.statusDetail = ""; + + /** + * OperationMetadata cancelRequested. + * @member {boolean} cancelRequested + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.cancelRequested = false; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * OperationMetadata requestResource. + * @member {google.protobuf.IAny|null|undefined} requestResource + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.requestResource = null; + + /** + * OperationMetadata stages. + * @member {Array.} stages + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.stages = $util.emptyArray; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {google.cloud.functions.v2.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.functions.v2.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.functions.v2.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {google.cloud.functions.v2.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.statusDetail != null && Object.hasOwnProperty.call(message, "statusDetail")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.statusDetail); + if (message.cancelRequested != null && Object.hasOwnProperty.call(message, "cancelRequested")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.cancelRequested); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.apiVersion); + if (message.requestResource != null && Object.hasOwnProperty.call(message, "requestResource")) + $root.google.protobuf.Any.encode(message.requestResource, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.stages != null && message.stages.length) + for (var i = 0; i < message.stages.length; ++i) + $root.google.cloud.functions.v2.Stage.encode(message.stages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.functions.v2.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {google.cloud.functions.v2.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.target = reader.string(); + break; + case 4: + message.verb = reader.string(); + break; + case 5: + message.statusDetail = reader.string(); + break; + case 6: + message.cancelRequested = reader.bool(); + break; + case 7: + message.apiVersion = reader.string(); + break; + case 8: + message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.stages && message.stages.length)) + message.stages = []; + message.stages.push($root.google.cloud.functions.v2.Stage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + if (!$util.isString(message.statusDetail)) + return "statusDetail: string expected"; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + if (typeof message.cancelRequested !== "boolean") + return "cancelRequested: boolean expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; + if (message.requestResource != null && message.hasOwnProperty("requestResource")) { + var error = $root.google.protobuf.Any.verify(message.requestResource); + if (error) + return "requestResource." + error; + } + if (message.stages != null && message.hasOwnProperty("stages")) { + if (!Array.isArray(message.stages)) + return "stages: array expected"; + for (var i = 0; i < message.stages.length; ++i) { + var error = $root.google.cloud.functions.v2.Stage.verify(message.stages[i]); + if (error) + return "stages." + error; + } + } + return null; + }; + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.OperationMetadata) + return object; + var message = new $root.google.cloud.functions.v2.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.functions.v2.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.functions.v2.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.statusDetail != null) + message.statusDetail = String(object.statusDetail); + if (object.cancelRequested != null) + message.cancelRequested = Boolean(object.cancelRequested); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); + if (object.requestResource != null) { + if (typeof object.requestResource !== "object") + throw TypeError(".google.cloud.functions.v2.OperationMetadata.requestResource: object expected"); + message.requestResource = $root.google.protobuf.Any.fromObject(object.requestResource); + } + if (object.stages) { + if (!Array.isArray(object.stages)) + throw TypeError(".google.cloud.functions.v2.OperationMetadata.stages: array expected"); + message.stages = []; + for (var i = 0; i < object.stages.length; ++i) { + if (typeof object.stages[i] !== "object") + throw TypeError(".google.cloud.functions.v2.OperationMetadata.stages: object expected"); + message.stages[i] = $root.google.cloud.functions.v2.Stage.fromObject(object.stages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {google.cloud.functions.v2.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stages = []; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.statusDetail = ""; + object.cancelRequested = false; + object.apiVersion = ""; + object.requestResource = null; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.statusDetail != null && message.hasOwnProperty("statusDetail")) + object.statusDetail = message.statusDetail; + if (message.cancelRequested != null && message.hasOwnProperty("cancelRequested")) + object.cancelRequested = message.cancelRequested; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; + if (message.requestResource != null && message.hasOwnProperty("requestResource")) + object.requestResource = $root.google.protobuf.Any.toObject(message.requestResource, options); + if (message.stages && message.stages.length) { + object.stages = []; + for (var j = 0; j < message.stages.length; ++j) + object.stages[j] = $root.google.cloud.functions.v2.Stage.toObject(message.stages[j], options); + } + return object; + }; + + /** + * Converts this OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OperationMetadata; + })(); + + v2.Stage = (function() { + + /** + * Properties of a Stage. + * @memberof google.cloud.functions.v2 + * @interface IStage + * @property {google.cloud.functions.v2.Stage.Name|null} [name] Stage name + * @property {string|null} [message] Stage message + * @property {google.cloud.functions.v2.Stage.State|null} [state] Stage state + * @property {string|null} [resource] Stage resource + * @property {string|null} [resourceUri] Stage resourceUri + * @property {Array.|null} [stateMessages] Stage stateMessages + */ + + /** + * Constructs a new Stage. + * @memberof google.cloud.functions.v2 + * @classdesc Represents a Stage. + * @implements IStage + * @constructor + * @param {google.cloud.functions.v2.IStage=} [properties] Properties to set + */ + function Stage(properties) { + this.stateMessages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Stage name. + * @member {google.cloud.functions.v2.Stage.Name} name + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.name = 0; + + /** + * Stage message. + * @member {string} message + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.message = ""; + + /** + * Stage state. + * @member {google.cloud.functions.v2.Stage.State} state + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.state = 0; + + /** + * Stage resource. + * @member {string} resource + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.resource = ""; + + /** + * Stage resourceUri. + * @member {string} resourceUri + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.resourceUri = ""; + + /** + * Stage stateMessages. + * @member {Array.} stateMessages + * @memberof google.cloud.functions.v2.Stage + * @instance + */ + Stage.prototype.stateMessages = $util.emptyArray; + + /** + * Creates a new Stage instance using the specified properties. + * @function create + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {google.cloud.functions.v2.IStage=} [properties] Properties to set + * @returns {google.cloud.functions.v2.Stage} Stage instance + */ + Stage.create = function create(properties) { + return new Stage(properties); + }; + + /** + * Encodes the specified Stage message. Does not implicitly {@link google.cloud.functions.v2.Stage.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {google.cloud.functions.v2.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.name); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.resource); + if (message.resourceUri != null && Object.hasOwnProperty.call(message, "resourceUri")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.resourceUri); + if (message.stateMessages != null && message.stateMessages.length) + for (var i = 0; i < message.stateMessages.length; ++i) + $root.google.cloud.functions.v2.StateMessage.encode(message.stateMessages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Stage message, length delimited. Does not implicitly {@link google.cloud.functions.v2.Stage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {google.cloud.functions.v2.IStage} message Stage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Stage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Stage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.functions.v2.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.functions.v2.Stage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.int32(); + break; + case 2: + message.message = reader.string(); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.resource = reader.string(); + break; + case 5: + message.resourceUri = reader.string(); + break; + case 6: + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2.StateMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Stage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.functions.v2.Stage} Stage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Stage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Stage message. + * @function verify + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Stage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + switch (message.name) { + default: + return "name: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) + if (!$util.isString(message.resourceUri)) + return "resourceUri: string expected"; + if (message.stateMessages != null && message.hasOwnProperty("stateMessages")) { + if (!Array.isArray(message.stateMessages)) + return "stateMessages: array expected"; + for (var i = 0; i < message.stateMessages.length; ++i) { + var error = $root.google.cloud.functions.v2.StateMessage.verify(message.stateMessages[i]); + if (error) + return "stateMessages." + error; + } + } + return null; + }; + + /** + * Creates a Stage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v2.Stage} Stage + */ + Stage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v2.Stage) + return object; + var message = new $root.google.cloud.functions.v2.Stage(); + switch (object.name) { + case "NAME_UNSPECIFIED": + case 0: + message.name = 0; + break; + case "ARTIFACT_REGISTRY": + case 1: + message.name = 1; + break; + case "BUILD": + case 2: + message.name = 2; + break; + case "SERVICE": + case 3: + message.name = 3; + break; + case "TRIGGER": + case 4: + message.name = 4; + break; + case "SERVICE_ROLLBACK": + case 5: + message.name = 5; + break; + case "TRIGGER_ROLLBACK": + case 6: + message.name = 6; + break; + } + if (object.message != null) + message.message = String(object.message); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "NOT_STARTED": + case 1: + message.state = 1; + break; + case "IN_PROGRESS": + case 2: + message.state = 2; + break; + case "COMPLETE": + case 3: + message.state = 3; + break; + } + if (object.resource != null) + message.resource = String(object.resource); + if (object.resourceUri != null) + message.resourceUri = String(object.resourceUri); + if (object.stateMessages) { + if (!Array.isArray(object.stateMessages)) + throw TypeError(".google.cloud.functions.v2.Stage.stateMessages: array expected"); + message.stateMessages = []; + for (var i = 0; i < object.stateMessages.length; ++i) { + if (typeof object.stateMessages[i] !== "object") + throw TypeError(".google.cloud.functions.v2.Stage.stateMessages: object expected"); + message.stateMessages[i] = $root.google.cloud.functions.v2.StateMessage.fromObject(object.stateMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Stage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {google.cloud.functions.v2.Stage} message Stage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Stage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.stateMessages = []; + if (options.defaults) { + object.name = options.enums === String ? "NAME_UNSPECIFIED" : 0; + object.message = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.resource = ""; + object.resourceUri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = options.enums === String ? $root.google.cloud.functions.v2.Stage.Name[message.name] : message.name; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.functions.v2.Stage.State[message.state] : message.state; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) + object.resourceUri = message.resourceUri; + if (message.stateMessages && message.stateMessages.length) { + object.stateMessages = []; + for (var j = 0; j < message.stateMessages.length; ++j) + object.stateMessages[j] = $root.google.cloud.functions.v2.StateMessage.toObject(message.stateMessages[j], options); + } + return object; + }; + + /** + * Converts this Stage to JSON. + * @function toJSON + * @memberof google.cloud.functions.v2.Stage + * @instance + * @returns {Object.} JSON object + */ + Stage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Name enum. + * @name google.cloud.functions.v2.Stage.Name + * @enum {number} + * @property {number} NAME_UNSPECIFIED=0 NAME_UNSPECIFIED value + * @property {number} ARTIFACT_REGISTRY=1 ARTIFACT_REGISTRY value + * @property {number} BUILD=2 BUILD value + * @property {number} SERVICE=3 SERVICE value + * @property {number} TRIGGER=4 TRIGGER value + * @property {number} SERVICE_ROLLBACK=5 SERVICE_ROLLBACK value + * @property {number} TRIGGER_ROLLBACK=6 TRIGGER_ROLLBACK value + */ + Stage.Name = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NAME_UNSPECIFIED"] = 0; + values[valuesById[1] = "ARTIFACT_REGISTRY"] = 1; + values[valuesById[2] = "BUILD"] = 2; + values[valuesById[3] = "SERVICE"] = 3; + values[valuesById[4] = "TRIGGER"] = 4; + values[valuesById[5] = "SERVICE_ROLLBACK"] = 5; + values[valuesById[6] = "TRIGGER_ROLLBACK"] = 6; + return values; + })(); + + /** + * State enum. + * @name google.cloud.functions.v2.Stage.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} NOT_STARTED=1 NOT_STARTED value + * @property {number} IN_PROGRESS=2 IN_PROGRESS value + * @property {number} COMPLETE=3 COMPLETE value + */ + Stage.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOT_STARTED"] = 1; + values[valuesById[2] = "IN_PROGRESS"] = 2; + values[valuesById[3] = "COMPLETE"] = 3; + return values; + })(); + + return Stage; + })(); + + return v2; + })(); + functions.v2alpha = (function() { /** diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index deecc0c40b8..31d343a0d5c 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -808,6 +808,991 @@ } } }, + "v2": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/functions/v2;functions", + "java_multiple_files": true, + "java_outer_classname": "FunctionsProto", + "java_package": "com.google.cloud.functions.v2", + "objc_class_prefix": "GCF", + "(google.api.resource_definition).type": "cloudkms.googleapis.com/CryptoKey", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" + }, + "nested": { + "FunctionService": { + "options": { + "(google.api.default_host)": "cloudfunctions.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "GetFunction": { + "requestType": "GetFunctionRequest", + "responseType": "Function", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListFunctions": { + "requestType": "ListFunctionsRequest", + "responseType": "ListFunctionsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/functions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/functions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "CreateFunction": { + "requestType": "CreateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*}/functions", + "(google.api.http).body": "function", + "(google.api.method_signature)": "parent,function,function_id", + "(google.longrunning.operation_info).response_type": "google.cloud.functions.v2.Function", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*}/functions", + "body": "function" + } + }, + { + "(google.api.method_signature)": "parent,function,function_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.functions.v2.Function", + "metadata_type": "google.cloud.functions.v2.OperationMetadata" + } + } + ] + }, + "UpdateFunction": { + "requestType": "UpdateFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v2/{function.name=projects/*/locations/*/functions/*}", + "(google.api.http).body": "function", + "(google.api.method_signature)": "function,update_mask", + "(google.longrunning.operation_info).response_type": "google.cloud.functions.v2.Function", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{function.name=projects/*/locations/*/functions/*}", + "body": "function" + } + }, + { + "(google.api.method_signature)": "function,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.functions.v2.Function", + "metadata_type": "google.cloud.functions.v2.OperationMetadata" + } + } + ] + }, + "DeleteFunction": { + "requestType": "DeleteFunctionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/functions/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.cloud.functions.v2.OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/functions/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.cloud.functions.v2.OperationMetadata" + } + } + ] + }, + "GenerateUploadUrl": { + "requestType": "GenerateUploadUrlRequest", + "responseType": "GenerateUploadUrlResponse", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*}/functions:generateUploadUrl", + "body": "*" + } + } + ] + }, + "GenerateDownloadUrl": { + "requestType": "GenerateDownloadUrlRequest", + "responseType": "GenerateDownloadUrlResponse", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/locations/*/functions/*}:generateDownloadUrl", + "body": "*" + } + } + ] + }, + "ListRuntimes": { + "requestType": "ListRuntimesRequest", + "responseType": "ListRuntimesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/locations/*}/runtimes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/locations/*}/runtimes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "Environment": { + "values": { + "ENVIRONMENT_UNSPECIFIED": 0, + "GEN_1": 1, + "GEN_2": 2 + } + }, + "Function": { + "options": { + "(google.api.resource).type": "cloudfunctions.googleapis.com/Function", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/functions/{function}", + "(google.api.resource).plural": "functions", + "(google.api.resource).singular": "function" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "environment": { + "type": "Environment", + "id": 10 + }, + "description": { + "type": "string", + "id": 2 + }, + "buildConfig": { + "type": "BuildConfig", + "id": 3 + }, + "serviceConfig": { + "type": "ServiceConfig", + "id": 4 + }, + "eventTrigger": { + "type": "EventTrigger", + "id": 5 + }, + "state": { + "type": "State", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + }, + "stateMessages": { + "rule": "repeated", + "type": "StateMessage", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "FAILED": 2, + "DEPLOYING": 3, + "DELETING": 4, + "UNKNOWN": 5 + } + } + } + }, + "StateMessage": { + "fields": { + "severity": { + "type": "Severity", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + } + }, + "nested": { + "Severity": { + "values": { + "SEVERITY_UNSPECIFIED": 0, + "ERROR": 1, + "WARNING": 2, + "INFO": 3 + } + } + } + }, + "StorageSource": { + "fields": { + "bucket": { + "type": "string", + "id": 1 + }, + "object": { + "type": "string", + "id": 2 + }, + "generation": { + "type": "int64", + "id": 3 + } + } + }, + "RepoSource": { + "oneofs": { + "revision": { + "oneof": [ + "branchName", + "tagName", + "commitSha" + ] + } + }, + "fields": { + "branchName": { + "type": "string", + "id": 3 + }, + "tagName": { + "type": "string", + "id": 4 + }, + "commitSha": { + "type": "string", + "id": 5 + }, + "projectId": { + "type": "string", + "id": 1 + }, + "repoName": { + "type": "string", + "id": 2 + }, + "dir": { + "type": "string", + "id": 6 + }, + "invertRegex": { + "type": "bool", + "id": 7 + } + } + }, + "Source": { + "oneofs": { + "source": { + "oneof": [ + "storageSource", + "repoSource" + ] + } + }, + "fields": { + "storageSource": { + "type": "StorageSource", + "id": 1 + }, + "repoSource": { + "type": "RepoSource", + "id": 2 + } + } + }, + "SourceProvenance": { + "fields": { + "resolvedStorageSource": { + "type": "StorageSource", + "id": 1 + }, + "resolvedRepoSource": { + "type": "RepoSource", + "id": 2 + } + } + }, + "BuildConfig": { + "fields": { + "build": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/Build" + } + }, + "runtime": { + "type": "string", + "id": 2 + }, + "entryPoint": { + "type": "string", + "id": 3 + }, + "source": { + "type": "Source", + "id": 4 + }, + "sourceProvenance": { + "type": "SourceProvenance", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "workerPool": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "cloudbuild.googleapis.com/WorkerPool" + } + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 6 + }, + "dockerRepository": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "artifactregistry.googleapis.com/Repository" + } + } + } + }, + "ServiceConfig": { + "fields": { + "service": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "run.googleapis.com/Service" + } + }, + "timeoutSeconds": { + "type": "int32", + "id": 2 + }, + "availableMemory": { + "type": "string", + "id": 13 + }, + "environmentVariables": { + "keyType": "string", + "type": "string", + "id": 4 + }, + "maxInstanceCount": { + "type": "int32", + "id": 5 + }, + "minInstanceCount": { + "type": "int32", + "id": 12 + }, + "vpcConnector": { + "type": "string", + "id": 6, + "options": { + "(google.api.resource_reference).type": "vpcaccess.googleapis.com/Connector" + } + }, + "vpcConnectorEgressSettings": { + "type": "VpcConnectorEgressSettings", + "id": 7 + }, + "ingressSettings": { + "type": "IngressSettings", + "id": 8 + }, + "uri": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "serviceAccountEmail": { + "type": "string", + "id": 10 + }, + "allTrafficOnLatestRevision": { + "type": "bool", + "id": 16 + }, + "secretEnvironmentVariables": { + "rule": "repeated", + "type": "SecretEnvVar", + "id": 17 + }, + "secretVolumes": { + "rule": "repeated", + "type": "SecretVolume", + "id": 19 + }, + "revision": { + "type": "string", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "VpcConnectorEgressSettings": { + "values": { + "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": 0, + "PRIVATE_RANGES_ONLY": 1, + "ALL_TRAFFIC": 2 + } + }, + "IngressSettings": { + "values": { + "INGRESS_SETTINGS_UNSPECIFIED": 0, + "ALLOW_ALL": 1, + "ALLOW_INTERNAL_ONLY": 2, + "ALLOW_INTERNAL_AND_GCLB": 3 + } + } + } + }, + "SecretEnvVar": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "version": { + "type": "string", + "id": 4 + } + } + }, + "SecretVolume": { + "fields": { + "mountPath": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "secret": { + "type": "string", + "id": 3 + }, + "versions": { + "rule": "repeated", + "type": "SecretVersion", + "id": 4 + } + }, + "nested": { + "SecretVersion": { + "fields": { + "version": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + } + } + }, + "EventTrigger": { + "fields": { + "trigger": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Trigger" + } + }, + "triggerRegion": { + "type": "string", + "id": 2 + }, + "eventType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "eventFilters": { + "rule": "repeated", + "type": "EventFilter", + "id": 4 + }, + "pubsubTopic": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "pubsub.googleapis.com/Topic" + } + }, + "serviceAccountEmail": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "retryPolicy": { + "type": "RetryPolicy", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "channel": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Channel" + } + } + }, + "nested": { + "RetryPolicy": { + "values": { + "RETRY_POLICY_UNSPECIFIED": 0, + "RETRY_POLICY_DO_NOT_RETRY": 1, + "RETRY_POLICY_RETRY": 2 + } + } + } + }, + "EventFilter": { + "fields": { + "attribute": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "value": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "operator": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GetFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "ListFunctionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudfunctions.googleapis.com/Function" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "orderBy": { + "type": "string", + "id": 5 + } + } + }, + "ListFunctionsResponse": { + "fields": { + "functions": { + "rule": "repeated", + "type": "Function", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "CreateFunctionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "function": { + "type": "Function", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "functionId": { + "type": "string", + "id": 3 + } + } + }, + "UpdateFunctionRequest": { + "fields": { + "function": { + "type": "Function", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteFunctionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "GenerateUploadUrlRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + } + } + }, + "GenerateUploadUrlResponse": { + "fields": { + "uploadUrl": { + "type": "string", + "id": 1 + }, + "storageSource": { + "type": "StorageSource", + "id": 2 + } + } + }, + "GenerateDownloadUrlRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/Function" + } + } + } + }, + "GenerateDownloadUrlResponse": { + "fields": { + "downloadUrl": { + "type": "string", + "id": 1 + } + } + }, + "ListRuntimesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "filter": { + "type": "string", + "id": 2 + } + } + }, + "ListRuntimesResponse": { + "fields": { + "runtimes": { + "rule": "repeated", + "type": "Runtime", + "id": 1 + } + }, + "nested": { + "Runtime": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 5 + }, + "stage": { + "type": "RuntimeStage", + "id": 2 + }, + "warnings": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "environment": { + "type": "Environment", + "id": 4 + } + } + }, + "RuntimeStage": { + "values": { + "RUNTIME_STAGE_UNSPECIFIED": 0, + "DEVELOPMENT": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5, + "DECOMMISSIONED": 6 + } + } + } + }, + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "target": { + "type": "string", + "id": 3 + }, + "verb": { + "type": "string", + "id": 4 + }, + "statusDetail": { + "type": "string", + "id": 5 + }, + "cancelRequested": { + "type": "bool", + "id": 6 + }, + "apiVersion": { + "type": "string", + "id": 7 + }, + "requestResource": { + "type": "google.protobuf.Any", + "id": 8 + }, + "stages": { + "rule": "repeated", + "type": "Stage", + "id": 9 + } + } + }, + "Stage": { + "fields": { + "name": { + "type": "Name", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "state": { + "type": "State", + "id": 3 + }, + "resource": { + "type": "string", + "id": 4 + }, + "resourceUri": { + "type": "string", + "id": 5 + }, + "stateMessages": { + "rule": "repeated", + "type": "StateMessage", + "id": 6 + } + }, + "nested": { + "Name": { + "values": { + "NAME_UNSPECIFIED": 0, + "ARTIFACT_REGISTRY": 1, + "BUILD": 2, + "SERVICE": 3, + "TRIGGER": 4, + "SERVICE_ROLLBACK": 5, + "TRIGGER_ROLLBACK": 6 + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "NOT_STARTED": 1, + "IN_PROGRESS": 2, + "COMPLETE": 3 + } + } + } + } + } + }, "v2alpha": { "options": { "go_package": "google.golang.org/genproto/googleapis/cloud/functions/v2alpha;functions", diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js new file mode 100644 index 00000000000..7198882b668 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js @@ -0,0 +1,72 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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, function1) { + // [START cloudfunctions_v2_generated_FunctionService_CreateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Function to be created. + */ + // const function = {} + /** + * The ID to use for the function, which will become the final component of + * the function's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + */ + // const functionId = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callCreateFunction() { + // Construct request + const request = { + parent, + function1, + }; + + // Run request + const [operation] = await functionsClient.createFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateFunction(); + // [END cloudfunctions_v2_generated_FunctionService_CreateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js new file mode 100644 index 00000000000..9744732034c --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2_generated_FunctionService_DeleteFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which should be deleted. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callDeleteFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await functionsClient.deleteFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteFunction(); + // [END cloudfunctions_v2_generated_FunctionService_DeleteFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js new file mode 100644 index 00000000000..fa98e64f8ae --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of function for which source code Google Cloud Storage signed + * URL should be generated. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateDownloadUrl() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.generateDownloadUrl(request); + console.log(response); + } + + callGenerateDownloadUrl(); + // [END cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js new file mode 100644 index 00000000000..ab5e53d96cf --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js @@ -0,0 +1,59 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGenerateUploadUrl() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.generateUploadUrl(request); + console.log(response); + } + + callGenerateUploadUrl(); + // [END cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js new file mode 100644 index 00000000000..6ea862fc56d --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js @@ -0,0 +1,58 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2_generated_FunctionService_GetFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the function which details should be obtained. + */ + // const name = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callGetFunction() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await functionsClient.getFunction(request); + console.log(response); + } + + callGetFunction(); + // [END cloudfunctions_v2_generated_FunctionService_GetFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js new file mode 100644 index 00000000000..f73e73993fa --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js @@ -0,0 +1,87 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2_generated_FunctionService_ListFunctions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + */ + // const parent = 'abc123' + /** + * Maximum number of functions to return per call. + */ + // const pageSize = 1234 + /** + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListFunctions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await functionsClient.listFunctionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFunctions(); + // [END cloudfunctions_v2_generated_FunctionService_ListFunctions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js b/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js new file mode 100644 index 00000000000..5f1c1aa5ce5 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js @@ -0,0 +1,64 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 cloudfunctions_v2_generated_FunctionService_ListRuntimes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location from which the runtimes should be listed, + * specified in the format `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + */ + // const filter = 'abc123' + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callListRuntimes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await functionsClient.listRuntimes(request); + console.log(response); + } + + callListRuntimes(); + // [END cloudfunctions_v2_generated_FunctionService_ListRuntimes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js new file mode 100644 index 00000000000..4809d97928b --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js @@ -0,0 +1,65 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(function1) { + // [START cloudfunctions_v2_generated_FunctionService_UpdateFunction_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. New version of the function. + */ + // const function = {} + /** + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request will be + * updated. + */ + // const updateMask = {} + + // Imports the Functions library + const {FunctionServiceClient} = require('@google-cloud/functions').v2; + + // Instantiates a client + const functionsClient = new FunctionServiceClient(); + + async function callUpdateFunction() { + // Construct request + const request = { + function1, + }; + + // Run request + const [operation] = await functionsClient.updateFunction(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateFunction(); + // [END cloudfunctions_v2_generated_FunctionService_UpdateFunction_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json new file mode 100644 index 00000000000..f7cda5ba911 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json @@ -0,0 +1,367 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "2.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.functions.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GetFunction_async", + "title": "FunctionService getFunction Sample", + "origin": "API_DEFINITION", + "description": " Returns a function with the given name from the requested project.", + "canonical": true, + "file": "function_service.get_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2.FunctionService.GetFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.Function", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GetFunction", + "fullName": "google.cloud.functions.v2.FunctionService.GetFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_ListFunctions_async", + "title": "FunctionService listFunctions Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of functions that belong to the requested project.", + "canonical": true, + "file": "function_service.list_functions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2.FunctionService.ListFunctions", + "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.functions.v2.ListFunctionsResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "ListFunctions", + "fullName": "google.cloud.functions.v2.FunctionService.ListFunctions", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_CreateFunction_async", + "title": "FunctionService createFunction Sample", + "origin": "API_DEFINITION", + "description": " Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.", + "canonical": true, + "file": "function_service.create_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.CreateFunction", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "function", + "type": ".google.cloud.functions.v2.Function" + }, + { + "name": "function_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "CreateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.CreateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_UpdateFunction_async", + "title": "FunctionService updateFunction Sample", + "origin": "API_DEFINITION", + "description": " Updates existing function.", + "canonical": true, + "file": "function_service.update_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.UpdateFunction", + "async": true, + "parameters": [ + { + "name": "function", + "type": ".google.cloud.functions.v2.Function" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "UpdateFunction", + "fullName": "google.cloud.functions.v2.FunctionService.UpdateFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_DeleteFunction_async", + "title": "FunctionService deleteFunction Sample", + "origin": "API_DEFINITION", + "description": " Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.", + "canonical": true, + "file": "function_service.delete_function.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2.FunctionService.DeleteFunction", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "DeleteFunction", + "fullName": "google.cloud.functions.v2.FunctionService.DeleteFunction", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async", + "title": "FunctionService generateUploadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`", + "canonical": true, + "file": "function_service.generate_upload_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.GenerateUploadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateUploadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async", + "title": "FunctionService generateDownloadUrl Sample", + "origin": "API_DEFINITION", + "description": " Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls", + "canonical": true, + "file": "function_service.generate_download_url.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateDownloadUrl", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.GenerateDownloadUrlResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "GenerateDownloadUrl", + "fullName": "google.cloud.functions.v2.FunctionService.GenerateDownloadUrl", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + }, + { + "regionTag": "cloudfunctions_v2_generated_FunctionService_ListRuntimes_async", + "title": "FunctionService listRuntimes Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of runtimes that are supported for the requested project.", + "canonical": true, + "file": "function_service.list_runtimes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2.FunctionService.ListRuntimes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.functions.v2.ListRuntimesResponse", + "client": { + "shortName": "FunctionServiceClient", + "fullName": "google.cloud.functions.v2.FunctionServiceClient" + }, + "method": { + "shortName": "ListRuntimes", + "fullName": "google.cloud.functions.v2.FunctionService.ListRuntimes", + "service": { + "shortName": "FunctionService", + "fullName": "google.cloud.functions.v2.FunctionService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-functions/src/index.ts b/packages/google-cloud-functions/src/index.ts index 9a05b7715c9..ee0653e9ff7 100644 --- a/packages/google-cloud-functions/src/index.ts +++ b/packages/google-cloud-functions/src/index.ts @@ -17,13 +17,14 @@ // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; +import * as v2 from './v2'; import * as v2alpha from './v2alpha'; import * as v2beta from './v2beta'; const CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; type CloudFunctionsServiceClient = v1.CloudFunctionsServiceClient; -export {v1, v2alpha, v2beta, CloudFunctionsServiceClient}; -export default {v1, v2alpha, v2beta, CloudFunctionsServiceClient}; +export {v1, v2, v2alpha, v2beta, CloudFunctionsServiceClient}; +export default {v1, v2, v2alpha, v2beta, CloudFunctionsServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-functions/src/v2/function_service_client.ts b/packages/google-cloud-functions/src/v2/function_service_client.ts new file mode 100644 index 00000000000..53fab6b0fa9 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/function_service_client.ts @@ -0,0 +1,2413 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/function_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './function_service_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Functions is used to deploy functions that are executed by + * Google in response to various events. Data connected with that event is + * passed to a function as the input data. + * + * A **function** is a resource which describes a function that should be + * executed and how it is triggered. + * @class + * @memberof v2 + */ +export class FunctionServiceClient { + 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}; + 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; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + functionServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FunctionServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FunctionServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.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 !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : 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 = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new IamClient(this._gaxGrpc, opts); + + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else 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); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + buildPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/builds/{build}' + ), + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + connectorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectors/{connector}' + ), + functionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/functions/{function}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + repositoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/repositories/{repository}' + ), + servicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + triggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + workerPoolPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workerPools/{worker_pool}' + ), + }; + + // 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 = { + listFunctions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'functions' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(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: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v2/{resource=projects/*/locations/*/functions/*}:getIamPolicy', + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v2/{resource=projects/*/locations/*/functions/*}:setIamPolicy', + body: '*', + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v2/{resource=projects/*/locations/*/functions/*}:testIamPermissions', + body: '*', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*/locations/*}/operations', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2.Function' + ) as gax.protobuf.Type; + const createFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata' + ) as gax.protobuf.Type; + const updateFunctionResponse = protoFilesRoot.lookup( + '.google.cloud.functions.v2.Function' + ) as gax.protobuf.Type; + const updateFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata' + ) as gax.protobuf.Type; + const deleteFunctionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteFunctionMetadata = protoFilesRoot.lookup( + '.google.cloud.functions.v2.OperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createFunctionResponse.decode.bind(createFunctionResponse), + createFunctionMetadata.decode.bind(createFunctionMetadata) + ), + updateFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateFunctionResponse.decode.bind(updateFunctionResponse), + updateFunctionMetadata.decode.bind(updateFunctionMetadata) + ), + deleteFunction: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteFunctionResponse.decode.bind(deleteFunctionResponse), + deleteFunctionMetadata.decode.bind(deleteFunctionMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.functions.v2.FunctionService', + 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 = gax.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.functionServiceStub) { + return this.functionServiceStub; + } + + // Put together the "service stub" for + // google.cloud.functions.v2.FunctionService. + this.functionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.functions.v2.FunctionService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.functions.v2.FunctionService, + 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 functionServiceStubMethods = [ + 'getFunction', + 'listFunctions', + 'createFunction', + 'updateFunction', + 'deleteFunction', + 'generateUploadUrl', + 'generateDownloadUrl', + 'listRuntimes', + ]; + for (const methodName of functionServiceStubMethods) { + const callPromise = this.functionServiceStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.functionServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudfunctions.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + 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 function with the given name from the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which details should be obtained. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Function]{@link google.cloud.functions.v2.Function}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/function_service.get_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GetFunction_async + */ + getFunction( + request?: protos.google.cloud.functions.v2.IGetFunctionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | undefined, + {} | undefined + ] + >; + getFunction( + request: protos.google.cloud.functions.v2.IGetFunctionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): void; + getFunction( + request: protos.google.cloud.functions.v2.IGetFunctionRequest, + callback: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): void; + getFunction( + request?: protos.google.cloud.functions.v2.IGetFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2.IFunction, + | protos.google.cloud.functions.v2.IGetFunctionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IGetFunctionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFunction(request, options, callback); + } + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the Google Cloud Storage signed URL + * should be generated, specified in the format `projects/* /locations/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v2.GenerateUploadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/function_service.generate_upload_url.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async + */ + generateUploadUrl( + request?: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | undefined, + {} | undefined + ] + >; + generateUploadUrl( + request: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateUploadUrl( + request?: protos.google.cloud.functions.v2.IGenerateUploadUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateUploadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2.IGenerateUploadUrlResponse, + protos.google.cloud.functions.v2.IGenerateUploadUrlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.generateUploadUrl(request, options, callback); + } + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * 30 minutes of generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of function for which source code Google Cloud Storage signed + * URL should be generated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateDownloadUrlResponse]{@link google.cloud.functions.v2.GenerateDownloadUrlResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/function_service.generate_download_url.js + * region_tag:cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async + */ + generateDownloadUrl( + request?: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | undefined, + {} | undefined + ] + >; + generateDownloadUrl( + request: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateDownloadUrl( + request: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + callback: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generateDownloadUrl( + request?: protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + | protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v2.IGenerateDownloadUrlRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.generateDownloadUrl(request, options, callback); + } + /** + * Returns a list of runtimes that are supported for the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the runtimes should be listed, + * specified in the format `projects/* /locations/*` + * @param {string} request.filter + * The filter for Runtimes that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListRuntimesResponse]{@link google.cloud.functions.v2.ListRuntimesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/function_service.list_runtimes.js + * region_tag:cloudfunctions_v2_generated_FunctionService_ListRuntimes_async + */ + listRuntimes( + request?: protos.google.cloud.functions.v2.IListRuntimesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | undefined, + {} | undefined + ] + >; + listRuntimes( + request: protos.google.cloud.functions.v2.IListRuntimesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, + {} | null | undefined + > + ): void; + listRuntimes( + request: protos.google.cloud.functions.v2.IListRuntimesRequest, + callback: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, + {} | null | undefined + > + ): void; + listRuntimes( + request?: protos.google.cloud.functions.v2.IListRuntimesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + | protos.google.cloud.functions.v2.IListRuntimesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.functions.v2.IListRuntimesResponse, + protos.google.cloud.functions.v2.IListRuntimesRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listRuntimes(request, options, callback); + } + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the function should be created, specified + * in the format `projects/* /locations/*` + * @param {google.cloud.functions.v2.Function} request.function + * Required. Function to be created. + * @param {string} request.functionId + * The ID to use for the function, which will become the final component of + * the function's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.create_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_CreateFunction_async + */ + createFunction( + request?: protos.google.cloud.functions.v2.ICreateFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createFunction( + request: protos.google.cloud.functions.v2.ICreateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createFunction( + request: protos.google.cloud.functions.v2.ICreateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createFunction( + request?: protos.google.cloud.functions.v2.ICreateFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.create_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_CreateFunction_async + */ + async checkCreateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v2.Function, + protos.google.cloud.functions.v2.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v2.Function, + protos.google.cloud.functions.v2.OperationMetadata + >; + } + /** + * Updates existing function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.functions.v2.Function} request.function + * Required. New version of the function. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * If no field mask is provided, all provided fields in the request 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.update_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_UpdateFunction_async + */ + updateFunction( + request?: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateFunction( + request: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateFunction( + request: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + callback: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateFunction( + request?: protos.google.cloud.functions.v2.IUpdateFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + 'function.name': request.function!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.update_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_UpdateFunction_async + */ + async checkUpdateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v2.Function, + protos.google.cloud.functions.v2.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v2.Function, + protos.google.cloud.functions.v2.OperationMetadata + >; + } + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the function which should 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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.delete_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_DeleteFunction_async + */ + deleteFunction( + request?: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteFunction( + request: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteFunction( + request: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteFunction( + request?: protos.google.cloud.functions.v2.IDeleteFunctionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteFunction(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteFunction()`. + * @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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/function_service.delete_function.js + * region_tag:cloudfunctions_v2_generated_FunctionService_DeleteFunction_async + */ + async checkDeleteFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v2.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v2.OperationMetadata + >; + } + /** + * Returns a list of functions that belong to the requested project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Function]{@link google.cloud.functions.v2.Function}. + * 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFunctions( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.functions.v2.IFunction[], + protos.google.cloud.functions.v2.IListFunctionsRequest | null, + protos.google.cloud.functions.v2.IListFunctionsResponse + ] + >; + listFunctions( + request: protos.google.cloud.functions.v2.IListFunctionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + | protos.google.cloud.functions.v2.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2.IFunction + > + ): void; + listFunctions( + request: protos.google.cloud.functions.v2.IListFunctionsRequest, + callback: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + | protos.google.cloud.functions.v2.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2.IFunction + > + ): void; + listFunctions( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + | protos.google.cloud.functions.v2.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2.IFunction + >, + callback?: PaginationCallback< + protos.google.cloud.functions.v2.IListFunctionsRequest, + | protos.google.cloud.functions.v2.IListFunctionsResponse + | null + | undefined, + protos.google.cloud.functions.v2.IFunction + > + ): Promise< + [ + protos.google.cloud.functions.v2.IFunction[], + protos.google.cloud.functions.v2.IListFunctionsRequest | null, + protos.google.cloud.functions.v2.IListFunctionsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFunctions(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 [Function]{@link google.cloud.functions.v2.Function} 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 `listFunctionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFunctionsStream( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listFunctions`, 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 and location from which the function should be listed, + * specified in the format `projects/* /locations/*` + * If you want to list functions in all locations, use "-" in place of a + * location. When listing functions in all locations, if one or more + * location(s) are unreachable, the response will contain functions from all + * reachable locations along with the names of any unreachable locations. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * The value returned by the last + * `ListFunctionsResponse`; indicates that + * this is a continuation of a prior `ListFunctions` call, and that the + * system should return the next page of data. + * @param {string} request.filter + * The filter for Functions that match the filter expression, + * following the syntax outlined in https://google.aip.dev/160. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a comma + * separated list of fields. The default sorting oder is ascending. + * See https://google.aip.dev/132#ordering. + * @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 [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Function]{@link google.cloud.functions.v2.Function}. 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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v2/function_service.list_functions.js + * region_tag:cloudfunctions_v2_generated_FunctionService_ListFunctions_async + */ + listFunctionsAsync( + request?: protos.google.cloud.functions.v2.IListFunctionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as unknown as RequestType, + 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 [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: 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 { + 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 + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + 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 { + 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 + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} 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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: 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 { + 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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * 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); + } + + /** + * Lists information about the supported locations for this service. 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 [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.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 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"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, + options?: + | 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]> { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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. + * + * @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 { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + 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 [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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, + options?: + | 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 { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified build resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} build + * @returns {string} Resource name string. + */ + buildPath(project: string, location: string, build: string) { + return this.pathTemplates.buildPathTemplate.render({ + project: project, + location: location, + build: build, + }); + } + + /** + * Parse the project from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).project; + } + + /** + * Parse the location from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).location; + } + + /** + * Parse the build from Build resource. + * + * @param {string} buildName + * A fully-qualified path representing Build resource. + * @returns {string} A string representing the build. + */ + matchBuildFromBuildName(buildName: string) { + return this.pathTemplates.buildPathTemplate.match(buildName).build; + } + + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project: string, location: string, channel: string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified connector resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connector + * @returns {string} Resource name string. + */ + connectorPath(project: string, location: string, connector: string) { + return this.pathTemplates.connectorPathTemplate.render({ + project: project, + location: location, + connector: connector, + }); + } + + /** + * Parse the project from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .project; + } + + /** + * Parse the location from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .location; + } + + /** + * Parse the connector from Connector resource. + * + * @param {string} connectorName + * A fully-qualified path representing Connector resource. + * @returns {string} A string representing the connector. + */ + matchConnectorFromConnectorName(connectorName: string) { + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .connector; + } + + /** + * Return a fully-qualified function resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + functionPath(project: string, location: string, functionParam: string) { + return this.pathTemplates.functionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * Parse the project from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).project; + } + + /** + * Parse the location from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).location; + } + + /** + * Parse the function from Function resource. + * + * @param {string} functionName + * A fully-qualified path representing Function resource. + * @returns {string} A string representing the function. + */ + matchFunctionFromFunctionName(functionName: string) { + return this.pathTemplates.functionPathTemplate.match(functionName).function; + } + + /** + * 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 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 repository resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} repository + * @returns {string} Resource name string. + */ + repositoryPath(project: string, location: string, repository: string) { + return this.pathTemplates.repositoryPathTemplate.render({ + project: project, + location: location, + repository: repository, + }); + } + + /** + * Parse the project from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .project; + } + + /** + * Parse the location from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .location; + } + + /** + * Parse the repository from Repository resource. + * + * @param {string} repositoryName + * A fully-qualified path representing Repository resource. + * @returns {string} A string representing the repository. + */ + matchRepositoryFromRepositoryName(repositoryName: string) { + return this.pathTemplates.repositoryPathTemplate.match(repositoryName) + .repository; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(project: string, location: string, service: string) { + return this.pathTemplates.servicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).project; + } + + /** + * Parse the location from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).location; + } + + /** + * Parse the service from Service resource. + * + * @param {string} serviceName + * A fully-qualified path representing Service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromServiceName(serviceName: string) { + return this.pathTemplates.servicePathTemplate.match(serviceName).service; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project: string, topic: string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * Return a fully-qualified trigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + triggerPath(project: string, location: string, trigger: string) { + return this.pathTemplates.triggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).project; + } + + /** + * Parse the location from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).location; + } + + /** + * Parse the trigger from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; + } + + /** + * Return a fully-qualified workerPool resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} worker_pool + * @returns {string} Resource name string. + */ + workerPoolPath(project: string, location: string, workerPool: string) { + return this.pathTemplates.workerPoolPathTemplate.render({ + project: project, + location: location, + worker_pool: workerPool, + }); + } + + /** + * Parse the project from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .project; + } + + /** + * Parse the location from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .location; + } + + /** + * Parse the worker_pool from WorkerPool resource. + * + * @param {string} workerPoolName + * A fully-qualified path representing WorkerPool resource. + * @returns {string} A string representing the worker_pool. + */ + matchWorkerPoolFromWorkerPoolName(workerPoolName: string) { + return this.pathTemplates.workerPoolPathTemplate.match(workerPoolName) + .worker_pool; + } + + /** + * 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.functionServiceStub && !this._terminated) { + return this.functionServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-functions/src/v2/function_service_client_config.json b/packages/google-cloud-functions/src/v2/function_service_client_config.json new file mode 100644 index 00000000000..936769f0cb7 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/function_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.functions.v2.FunctionService": { + "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": { + "GetFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListFunctions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateUploadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateDownloadUrl": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRuntimes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v2/function_service_proto_list.json b/packages/google-cloud-functions/src/v2/function_service_proto_list.json new file mode 100644 index 00000000000..cfde205a091 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/function_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/functions/v2/functions.proto" +] diff --git a/packages/google-cloud-functions/src/v2/gapic_metadata.json b/packages/google-cloud-functions/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..4342a4d7966 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/gapic_metadata.json @@ -0,0 +1,107 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.functions.v2", + "libraryPackage": "@google-cloud/functions", + "services": { + "FunctionService": { + "clients": { + "grpc": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FunctionServiceClient", + "rpcs": { + "GetFunction": { + "methods": [ + "getFunction" + ] + }, + "GenerateUploadUrl": { + "methods": [ + "generateUploadUrl" + ] + }, + "GenerateDownloadUrl": { + "methods": [ + "generateDownloadUrl" + ] + }, + "ListRuntimes": { + "methods": [ + "listRuntimes" + ] + }, + "CreateFunction": { + "methods": [ + "createFunction" + ] + }, + "UpdateFunction": { + "methods": [ + "updateFunction" + ] + }, + "DeleteFunction": { + "methods": [ + "deleteFunction" + ] + }, + "ListFunctions": { + "methods": [ + "listFunctions", + "listFunctionsStream", + "listFunctionsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-functions/src/v2/index.ts b/packages/google-cloud-functions/src/v2/index.ts new file mode 100644 index 00000000000..a9477c6cf34 --- /dev/null +++ b/packages/google-cloud-functions/src/v2/index.ts @@ -0,0 +1,19 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {FunctionServiceClient} from './function_service_client'; diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2.ts b/packages/google-cloud-functions/test/gapic_function_service_v2.ts new file mode 100644 index 00000000000..52f37991902 --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_function_service_v2.ts @@ -0,0 +1,3093 @@ +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 functionserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; + +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.FunctionServiceClient', () => { + it('has servicePath', () => { + const servicePath = + functionserviceModule.v2.FunctionServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + functionserviceModule.v2.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = functionserviceModule.v2.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new functionserviceModule.v2.FunctionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + 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('getFunction', () => { + it('invokes getFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.Function() + ); + client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); + const [response] = await client.getFunction(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.Function() + ); + client.innerApiCalls.getFunction = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFunction( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IFunction | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getFunction with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFunction = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getFunction(request), expectedError); + assert( + (client.innerApiCalls.getFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFunction with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GetFunctionRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFunction(request), expectedError); + }); + }); + + describe('generateUploadUrl', () => { + it('invokes generateUploadUrl without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); + const [response] = await client.generateUploadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateUploadUrl without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() + ); + client.innerApiCalls.generateUploadUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateUploadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IGenerateUploadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateUploadUrl with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateUploadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateUploadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateUploadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateUploadUrl with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateUploadUrl(request), expectedError); + }); + }); + + describe('generateDownloadUrl', () => { + it('invokes generateDownloadUrl without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateDownloadUrl without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateDownloadUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IGenerateDownloadUrlResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes generateDownloadUrl with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.generateDownloadUrl = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + assert( + (client.innerApiCalls.generateDownloadUrl as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes generateDownloadUrl with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateDownloadUrl(request), expectedError); + }); + }); + + describe('listRuntimes', () => { + it('invokes listRuntimes without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); + const [response] = await client.listRuntimes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimes without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesResponse() + ); + client.innerApiCalls.listRuntimes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRuntimes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IListRuntimesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listRuntimes with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listRuntimes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listRuntimes(request), expectedError); + assert( + (client.innerApiCalls.listRuntimes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listRuntimes with closed client', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListRuntimesRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listRuntimes(request), expectedError); + }); + }); + + describe('createFunction', () => { + it('invokes createFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createFunction(request), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.CreateFunctionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkCreateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkCreateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateFunction', () => { + it('invokes updateFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.functions.v2.IFunction, + protos.google.cloud.functions.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateFunction(request), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.UpdateFunctionRequest() + ); + request.function = {}; + request.function.name = ''; + const expectedHeaderRequestParams = 'function.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkUpdateFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkUpdateFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteFunction', () => { + it('invokes deleteFunction without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFunction without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteFunction = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFunction( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.functions.v2.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteFunction with call error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteFunction(request), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFunction with LRO error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.DeleteFunctionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFunction = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteFunction as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteFunctionProgress without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.checkDeleteFunctionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteFunctionProgress with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkDeleteFunctionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listFunctions', () => { + it('invokes listFunctions without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFunctions without error using callback', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.innerApiCalls.listFunctions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFunctions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.functions.v2.IFunction[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listFunctions with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFunctions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listFunctions(request), expectedError); + assert( + (client.innerApiCalls.listFunctions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFunctionsStream without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2.Function[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v2.Function) => { + 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.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFunctionsStream with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listFunctionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.functions.v2.Function[] = []; + stream.on( + 'data', + (response: protos.google.cloud.functions.v2.Function) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFunctions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.functions.v2.IFunction[] = []; + const iterable = client.listFunctionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFunctions with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.functions.v2.ListFunctionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFunctions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFunctionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.functions.v2.IFunction[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listFunctions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.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.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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); + } + } + ); + }); + 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 functionserviceModule.v2.FunctionServiceClient({ + 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 functionserviceModule.v2.FunctionServiceClient({ + 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.ListOperationsResponse[] = + []; + 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 functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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.ListOperationsResponse[] = + []; + 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('build', () => { + const fakePath = '/rendered/path/build'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + build: 'buildValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.buildPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.buildPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('buildPath', () => { + const result = client.buildPath( + 'projectValue', + 'locationValue', + 'buildValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.buildPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromBuildName', () => { + const result = client.matchProjectFromBuildName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromBuildName', () => { + const result = client.matchLocationFromBuildName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchBuildFromBuildName', () => { + const result = client.matchBuildFromBuildName(fakePath); + assert.strictEqual(result, 'buildValue'); + assert( + (client.pathTemplates.buildPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('channel', () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + channel: 'channelValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'channelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('connector', () => { + const fakePath = '/rendered/path/connector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + connector: 'connectorValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.connectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('connectorPath', () => { + const result = client.connectorPath( + 'projectValue', + 'locationValue', + 'connectorValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.connectorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConnectorName', () => { + const result = client.matchProjectFromConnectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConnectorName', () => { + const result = client.matchLocationFromConnectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConnectorFromConnectorName', () => { + const result = client.matchConnectorFromConnectorName(fakePath); + assert.strictEqual(result, 'connectorValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('function', () => { + const fakePath = '/rendered/path/function'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + function: 'functionValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.functionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.functionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('functionPath', () => { + const result = client.functionPath( + 'projectValue', + 'locationValue', + 'functionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.functionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFunctionName', () => { + const result = client.matchProjectFromFunctionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFunctionName', () => { + const result = client.matchLocationFromFunctionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFunctionFromFunctionName', () => { + const result = client.matchFunctionFromFunctionName(fakePath); + assert.strictEqual(result, 'functionValue'); + assert( + (client.pathTemplates.functionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + 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('repository', () => { + const fakePath = '/rendered/path/repository'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + repository: 'repositoryValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.repositoryPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.repositoryPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('repositoryPath', () => { + const result = client.repositoryPath( + 'projectValue', + 'locationValue', + 'repositoryValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.repositoryPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRepositoryName', () => { + const result = client.matchProjectFromRepositoryName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromRepositoryName', () => { + const result = client.matchLocationFromRepositoryName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRepositoryFromRepositoryName', () => { + const result = client.matchRepositoryFromRepositoryName(fakePath); + assert.strictEqual(result, 'repositoryValue'); + assert( + (client.pathTemplates.repositoryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('service', () => { + const fakePath = '/rendered/path/service'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + service: 'serviceValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.servicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('servicePath', () => { + const result = client.servicePath( + 'projectValue', + 'locationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromServiceName', () => { + const result = client.matchProjectFromServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromServiceName', () => { + const result = client.matchLocationFromServiceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('topic', () => { + const fakePath = '/rendered/path/topic'; + const expectedParameters = { + project: 'projectValue', + topic: 'topicValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.topicPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath('projectValue', 'topicValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, 'topicValue'); + assert( + (client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('trigger', () => { + const fakePath = '/rendered/path/trigger'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + trigger: 'triggerValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.triggerPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.triggerPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('triggerPath', () => { + const result = client.triggerPath( + 'projectValue', + 'locationValue', + 'triggerValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.triggerPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTriggerName', () => { + const result = client.matchProjectFromTriggerName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTriggerName', () => { + const result = client.matchLocationFromTriggerName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTriggerFromTriggerName', () => { + const result = client.matchTriggerFromTriggerName(fakePath); + assert.strictEqual(result, 'triggerValue'); + assert( + (client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('workerPool', () => { + const fakePath = '/rendered/path/workerPool'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + worker_pool: 'workerPoolValue', + }; + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.workerPoolPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workerPoolPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workerPoolPath', () => { + const result = client.workerPoolPath( + 'projectValue', + 'locationValue', + 'workerPoolValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workerPoolPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWorkerPoolName', () => { + const result = client.matchProjectFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWorkerPoolName', () => { + const result = client.matchLocationFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWorkerPoolFromWorkerPoolName', () => { + const result = client.matchWorkerPoolFromWorkerPoolName(fakePath); + assert.strictEqual(result, 'workerPoolValue'); + assert( + (client.pathTemplates.workerPoolPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); From 69fa3723129fe9d8ea8cf1226146c1a40505a0f9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 14 Jul 2022 21:10:14 +0200 Subject: [PATCH 110/123] chore(deps): update dependency linkinator to v4 (#176) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [linkinator](https://togithub.com/JustinBeckwith/linkinator) | [`^2.1.1` -> `^4.0.0`](https://renovatebot.com/diffs/npm/linkinator/2.16.2/4.0.2) | [![age](https://badges.renovateapi.com/packages/npm/linkinator/4.0.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/linkinator/4.0.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/linkinator/4.0.2/compatibility-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/linkinator/4.0.2/confidence-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. ⚠ **Warning**: custom changes will be lost. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 83b0148b071..84aae74ebbe 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -50,7 +50,7 @@ "jsdoc": "^3.6.4", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", - "linkinator": "^2.1.1", + "linkinator": "^4.0.0", "mocha": "^9.2.2", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", From 69fd5a95b346755165eb56dd898e03553efbda80 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 21 Jul 2022 11:57:05 -0700 Subject: [PATCH 111/123] chore(main): release 2.2.0 (#173) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 2.2.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-functions/CHANGELOG.md | 8 ++++++++ packages/google-cloud-functions/package.json | 2 +- .../v1/snippet_metadata.google.cloud.functions.v1.json | 2 +- .../v2/snippet_metadata.google.cloud.functions.v2.json | 2 +- .../snippet_metadata.google.cloud.functions.v2alpha.json | 2 +- .../snippet_metadata.google.cloud.functions.v2beta.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 02283b5140e..a993c72fb29 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [2.2.0](https://github.com/googleapis/nodejs-functions/compare/v2.1.0...v2.2.0) (2022-07-14) + + +### Features + +* generating GAPIC libraries for Google Cloud Functions v2beta ([#175](https://github.com/googleapis/nodejs-functions/issues/175)) ([63a2cfd](https://github.com/googleapis/nodejs-functions/commit/63a2cfd6552495746f7af84cc5d4cdeec887f5e8)) +* support regapic LRO ([#172](https://github.com/googleapis/nodejs-functions/issues/172)) ([eb5486d](https://github.com/googleapis/nodejs-functions/commit/eb5486d20abaf81ce84730868ad4ed4f549d0f31)) + ## [2.1.0](https://github.com/googleapis/nodejs-functions/compare/v2.0.0...v2.1.0) (2022-06-20) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 84aae74ebbe..0ff618001bc 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "2.1.0", + "version": "2.2.0", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index a0582e585d5..8f86849d98e 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.1.0", + "version": "2.2.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json index f7cda5ba911..55c0381eb25 100644 --- a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json +++ b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.1.0", + "version": "2.2.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json index d43f0829d7f..746b8a414a4 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json +++ b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.1.0", + "version": "2.2.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json index d01a34ce827..e631a725e89 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json +++ b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.1.0", + "version": "2.2.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 1a2a7c9dc4a..9a468bf1d25 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^2.1.0" + "@google-cloud/functions": "^2.2.0" }, "devDependencies": { "c8": "^7.1.0", From ee278bcfa629fd4d276f49764476842ae888a07e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 00:10:30 +0000 Subject: [PATCH 112/123] fix: better support for fallback mode (#181) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 468790263 Source-Link: https://github.com/googleapis/googleapis/commit/873ab456273d105245df0fb82a6c17a814553b80 Source-Link: https://github.com/googleapis/googleapis-gen/commit/cb6f37aeff2a3472e40a7bbace8c67d75e24bee5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I2ZjM3YWVmZjJhMzQ3MmU0MGE3YmJhY2U4YzY3ZDc1ZTI0YmVlNSJ9 --- .../cloud_functions_service.call_function.js | 3 + ...cloud_functions_service.create_function.js | 3 + ...cloud_functions_service.delete_function.js | 3 + ...functions_service.generate_download_url.js | 3 + ...d_functions_service.generate_upload_url.js | 3 + .../cloud_functions_service.get_function.js | 3 + .../cloud_functions_service.get_iam_policy.js | 3 + .../cloud_functions_service.list_functions.js | 3 + .../cloud_functions_service.set_iam_policy.js | 3 + ..._functions_service.test_iam_permissions.js | 3 + ...cloud_functions_service.update_function.js | 3 + ...et_metadata.google.cloud.functions.v1.json | 22 +-- .../v2/function_service.create_function.js | 3 + .../v2/function_service.delete_function.js | 3 + .../function_service.generate_download_url.js | 3 + .../function_service.generate_upload_url.js | 3 + .../v2/function_service.get_function.js | 3 + .../v2/function_service.list_functions.js | 3 + .../v2/function_service.list_runtimes.js | 3 + .../v2/function_service.update_function.js | 3 + ...et_metadata.google.cloud.functions.v2.json | 16 +- .../function_service.create_function.js | 3 + .../function_service.delete_function.js | 3 + .../function_service.generate_download_url.js | 3 + .../function_service.generate_upload_url.js | 3 + .../v2alpha/function_service.get_function.js | 3 + .../function_service.list_functions.js | 3 + .../v2alpha/function_service.list_runtimes.js | 3 + .../function_service.update_function.js | 3 + ...tadata.google.cloud.functions.v2alpha.json | 16 +- .../function_service.create_function.js | 3 + .../function_service.delete_function.js | 3 + .../function_service.generate_download_url.js | 3 + .../function_service.generate_upload_url.js | 3 + .../v2beta/function_service.get_function.js | 3 + .../v2beta/function_service.list_functions.js | 3 + .../v2beta/function_service.list_runtimes.js | 3 + .../function_service.update_function.js | 3 + ...etadata.google.cloud.functions.v2beta.json | 16 +- .../src/v1/cloud_functions_service_client.ts | 14 +- .../src/v2/function_service_client.ts | 14 +- .../src/v2alpha/function_service_client.ts | 14 +- .../src/v2beta/function_service_client.ts | 14 +- .../test/gapic_cloud_functions_service_v1.ts | 178 +++++++++--------- .../test/gapic_function_service_v2.ts | 160 ++++++++-------- .../test/gapic_function_service_v2alpha.ts | 160 ++++++++-------- .../test/gapic_function_service_v2beta.ts | 160 ++++++++-------- 47 files changed, 501 insertions(+), 388 deletions(-) diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js index cba235e3218..c4cfc8faf0c 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js @@ -23,6 +23,9 @@ function main(name, data) { // [START cloudfunctions_v1_generated_CloudFunctionsService_CallFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js index 297f47f6484..fd7ed9226db 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js @@ -23,6 +23,9 @@ function main(location, function1) { // [START cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js index 13636fd8a05..0c35da5b8c9 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js index 20aff9d0b03..dc32b559d28 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js @@ -23,6 +23,9 @@ function main() { // [START cloudfunctions_v1_generated_CloudFunctionsService_GenerateDownloadUrl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js index 963f7b8805b..707d9b510d8 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js @@ -23,6 +23,9 @@ function main() { // [START cloudfunctions_v1_generated_CloudFunctionsService_GenerateUploadUrl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js index 9437697c724..f713c5dc690 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v1_generated_CloudFunctionsService_GetFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js index 8b9594a3d24..7cc8933f8f1 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js @@ -23,6 +23,9 @@ function main(resource) { // [START cloudfunctions_v1_generated_CloudFunctionsService_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. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js index dcfa4314206..e935eb973f3 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js @@ -23,6 +23,9 @@ function main() { // [START cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js index 290607b6046..be675c26943 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js @@ -23,6 +23,9 @@ function main(resource, policy) { // [START cloudfunctions_v1_generated_CloudFunctionsService_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. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js index de4aafd86ea..68f45a6c059 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js @@ -23,6 +23,9 @@ function main(resource, permissions) { // [START cloudfunctions_v1_generated_CloudFunctionsService_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. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js index a9a915eb558..6b21992ab74 100644 --- a/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js @@ -23,6 +23,9 @@ function main(function1) { // [START cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index 8f86849d98e..1e5bd20b34f 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 67, + "end": 70, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -110,7 +110,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -154,7 +154,7 @@ "segments": [ { "start": 25, - "end": 55, + "end": 58, "type": "FULL" } ], @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -238,7 +238,7 @@ "segments": [ { "start": 25, - "end": 55, + "end": 58, "type": "FULL" } ], @@ -282,7 +282,7 @@ "segments": [ { "start": 25, - "end": 68, + "end": 71, "type": "FULL" } ], @@ -326,7 +326,7 @@ "segments": [ { "start": 25, - "end": 55, + "end": 58, "type": "FULL" } ], @@ -370,7 +370,7 @@ "segments": [ { "start": 25, - "end": 66, + "end": 69, "type": "FULL" } ], @@ -418,7 +418,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -462,7 +462,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js index 7198882b668..c585666f560 100644 --- a/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js @@ -23,6 +23,9 @@ function main(parent, function1) { // [START cloudfunctions_v2_generated_FunctionService_CreateFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js index 9744732034c..63daecb7a1c 100644 --- a/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2_generated_FunctionService_DeleteFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js index fa98e64f8ae..28ed683607c 100644 --- a/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2_generated_FunctionService_GenerateDownloadUrl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js index ab5e53d96cf..6704ec9d56a 100644 --- a/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2_generated_FunctionService_GenerateUploadUrl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js index 6ea862fc56d..b97bfeacc83 100644 --- a/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2_generated_FunctionService_GetFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js index f73e73993fa..59d5e346ffc 100644 --- a/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2_generated_FunctionService_ListFunctions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js b/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js index 5f1c1aa5ce5..e31bd464ca0 100644 --- a/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2_generated_FunctionService_ListRuntimes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js b/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js index 4809d97928b..fe8f3a121c8 100644 --- a/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js @@ -23,6 +23,9 @@ function main(function1) { // [START cloudfunctions_v2_generated_FunctionService_UpdateFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json index 55c0381eb25..c0039628b49 100644 --- a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json +++ b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -62,7 +62,7 @@ "segments": [ { "start": 25, - "end": 79, + "end": 82, "type": "FULL" } ], @@ -118,7 +118,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -166,7 +166,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -210,7 +210,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -250,7 +250,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -290,7 +290,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -330,7 +330,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js index d59bad0f78a..f2023fd5027 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js @@ -23,6 +23,9 @@ function main(parent, function1) { // [START cloudfunctions_v2alpha_generated_FunctionService_CreateFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js index 87f9f61b701..0e1d8fb0cd5 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2alpha_generated_FunctionService_DeleteFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js index 1ffdf4e3264..56d9473faa5 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2alpha_generated_FunctionService_GenerateDownloadUrl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js index 70c5d31f667..b01f0882b43 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2alpha_generated_FunctionService_GenerateUploadUrl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js index 56d716bfcec..f4a6264ecd1 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2alpha_generated_FunctionService_GetFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js index cd3dabf2e03..e110be8b387 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2alpha_generated_FunctionService_ListFunctions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js index d642b220801..c25eb86f09b 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2alpha_generated_FunctionService_ListRuntimes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js index 856dfad7576..31be95a6d69 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js @@ -23,6 +23,9 @@ function main(function1) { // [START cloudfunctions_v2alpha_generated_FunctionService_UpdateFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json index 746b8a414a4..cccb5e218d0 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json +++ b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -62,7 +62,7 @@ "segments": [ { "start": 25, - "end": 79, + "end": 82, "type": "FULL" } ], @@ -118,7 +118,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -166,7 +166,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -210,7 +210,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -250,7 +250,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -290,7 +290,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -330,7 +330,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js index da1ae2daeba..917ce9f815e 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js @@ -23,6 +23,9 @@ function main(parent, function1) { // [START cloudfunctions_v2beta_generated_FunctionService_CreateFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js index 938c8dd0e26..7a862b3e9f5 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2beta_generated_FunctionService_DeleteFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js index bb8cd0f027e..063bc6872f9 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2beta_generated_FunctionService_GenerateDownloadUrl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js index f1bd6c681a4..fe3d0b49ed9 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2beta_generated_FunctionService_GenerateUploadUrl_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js index 50fa52ae121..0f6dca9671f 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudfunctions_v2beta_generated_FunctionService_GetFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js index 003333da810..421a9f30785 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2beta_generated_FunctionService_ListFunctions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js index a531d249864..8103ee13c16 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudfunctions_v2beta_generated_FunctionService_ListRuntimes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js b/packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js index e310003864e..579bf7a25c1 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js @@ -23,6 +23,9 @@ function main(function1) { // [START cloudfunctions_v2beta_generated_FunctionService_UpdateFunction_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json index e631a725e89..f8bffa482a5 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json +++ b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 50, + "end": 53, "type": "FULL" } ], @@ -62,7 +62,7 @@ "segments": [ { "start": 25, - "end": 79, + "end": 82, "type": "FULL" } ], @@ -118,7 +118,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -166,7 +166,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -210,7 +210,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -250,7 +250,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -290,7 +290,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -330,7 +330,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 3d0e90268a0..3b19399a922 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -30,7 +30,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -341,7 +340,8 @@ export class CloudFunctionsServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1224,7 +1224,7 @@ export class CloudFunctionsServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.createFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.functions.v1.CloudFunction, @@ -1363,7 +1363,7 @@ export class CloudFunctionsServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.updateFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.functions.v1.CloudFunction, @@ -1502,7 +1502,7 @@ export class CloudFunctionsServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1662,7 +1662,7 @@ export class CloudFunctionsServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listFunctions.createStream( - this.innerApiCalls.listFunctions as gax.GaxCall, + this.innerApiCalls.listFunctions as GaxCall, request, callSettings ); @@ -1718,7 +1718,7 @@ export class CloudFunctionsServiceClient { this.initialize(); return this.descriptors.page.listFunctions.asyncIterate( this.innerApiCalls['listFunctions'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-functions/src/v2/function_service_client.ts b/packages/google-cloud-functions/src/v2/function_service_client.ts index 53fab6b0fa9..1a39233ccc3 100644 --- a/packages/google-cloud-functions/src/v2/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2/function_service_client.ts @@ -34,7 +34,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -386,7 +385,8 @@ export class FunctionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -974,7 +974,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.createFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.functions.v2.Function, @@ -1115,7 +1115,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.updateFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.functions.v2.Function, @@ -1254,7 +1254,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1428,7 +1428,7 @@ export class FunctionServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listFunctions.createStream( - this.innerApiCalls.listFunctions as gax.GaxCall, + this.innerApiCalls.listFunctions as GaxCall, request, callSettings ); @@ -1491,7 +1491,7 @@ export class FunctionServiceClient { this.initialize(); return this.descriptors.page.listFunctions.asyncIterate( this.innerApiCalls['listFunctions'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts index dd71323241c..0d61b8b29d1 100644 --- a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts @@ -34,7 +34,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -386,7 +385,8 @@ export class FunctionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -998,7 +998,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.createFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.functions.v2alpha.Function, @@ -1139,7 +1139,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.updateFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.functions.v2alpha.Function, @@ -1278,7 +1278,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1452,7 +1452,7 @@ export class FunctionServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listFunctions.createStream( - this.innerApiCalls.listFunctions as gax.GaxCall, + this.innerApiCalls.listFunctions as GaxCall, request, callSettings ); @@ -1515,7 +1515,7 @@ export class FunctionServiceClient { this.initialize(); return this.descriptors.page.listFunctions.asyncIterate( this.innerApiCalls['listFunctions'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-functions/src/v2beta/function_service_client.ts b/packages/google-cloud-functions/src/v2beta/function_service_client.ts index d289f883309..0e61895b46a 100644 --- a/packages/google-cloud-functions/src/v2beta/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2beta/function_service_client.ts @@ -34,7 +34,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -386,7 +385,8 @@ export class FunctionServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -998,7 +998,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.createFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.functions.v2beta.Function, @@ -1139,7 +1139,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.updateFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.functions.v2beta.Function, @@ -1278,7 +1278,7 @@ export class FunctionServiceClient { const decodeOperation = new gax.Operation( operation, this.descriptors.longrunning.deleteFunction, - gax.createDefaultBackoffSettings() + this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.protobuf.Empty, @@ -1452,7 +1452,7 @@ export class FunctionServiceClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listFunctions.createStream( - this.innerApiCalls.listFunctions as gax.GaxCall, + this.innerApiCalls.listFunctions as GaxCall, request, callSettings ); @@ -1515,7 +1515,7 @@ export class FunctionServiceClient { this.initialize(); return this.descriptors.page.listFunctions.asyncIterate( this.innerApiCalls['listFunctions'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index 0d578dba935..5d04db61279 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -145,109 +145,111 @@ function stubAsyncIterationCall( } describe('v1.CloudFunctionsServiceClient', () => { - it('has servicePath', () => { - const servicePath = - cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudFunctionsServiceStub, undefined); - await client.initialize(); - assert(client.cloudFunctionsServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFunctionsServiceStub, undefined); + await client.initialize(); + assert(client.cloudFunctionsServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudFunctionsServiceStub); + client.close().then(() => { + done(); }); - client.initialize(); - assert(client.cloudFunctionsServiceStub); - client.close().then(() => { - done(); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudFunctionsServiceStub, undefined); + client.close().then(() => { + done(); }); - assert.strictEqual(client.cloudFunctionsServiceStub, undefined); - client.close().then(() => { - done(); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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 cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ - 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); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + 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); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('getFunction', () => { diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2.ts b/packages/google-cloud-functions/test/gapic_function_service_v2.ts index 52f37991902..5d0f0039da8 100644 --- a/packages/google-cloud-functions/test/gapic_function_service_v2.ts +++ b/packages/google-cloud-functions/test/gapic_function_service_v2.ts @@ -151,101 +151,103 @@ function stubAsyncIterationCall( } describe('v2.FunctionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - functionserviceModule.v2.FunctionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - functionserviceModule.v2.FunctionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = functionserviceModule.v2.FunctionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + functionserviceModule.v2.FunctionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new functionserviceModule.v2.FunctionServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + functionserviceModule.v2.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - fallback: true, + it('has port', () => { + const port = functionserviceModule.v2.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new functionserviceModule.v2.FunctionServiceClient(); + assert(client); }); - assert.strictEqual(client.functionServiceStub, undefined); - await client.initialize(); - assert(client.functionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.functionServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.functionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new functionserviceModule.v2.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2.FunctionServiceClient({ + 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()); }); - 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 functionserviceModule.v2.FunctionServiceClient({ - 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); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2.FunctionServiceClient({ + 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); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('getFunction', () => { diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts b/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts index 971c84b76c5..d3646e4427d 100644 --- a/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts +++ b/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts @@ -151,101 +151,103 @@ function stubAsyncIterationCall( } describe('v2alpha.FunctionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - functionserviceModule.v2alpha.FunctionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - functionserviceModule.v2alpha.FunctionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = functionserviceModule.v2alpha.FunctionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + functionserviceModule.v2alpha.FunctionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + functionserviceModule.v2alpha.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - fallback: true, + it('has port', () => { + const port = functionserviceModule.v2alpha.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient(); + assert(client); }); - assert.strictEqual(client.functionServiceStub, undefined); - await client.initialize(); - assert(client.functionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.functionServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.functionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new functionserviceModule.v2alpha.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + 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()); }); - 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 functionserviceModule.v2alpha.FunctionServiceClient({ - 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); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2alpha.FunctionServiceClient({ + 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); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('getFunction', () => { diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts b/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts index 5be910a77f8..333819a8e48 100644 --- a/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts +++ b/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts @@ -151,101 +151,103 @@ function stubAsyncIterationCall( } describe('v2beta.FunctionServiceClient', () => { - it('has servicePath', () => { - const servicePath = - functionserviceModule.v2beta.FunctionServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - functionserviceModule.v2beta.FunctionServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = functionserviceModule.v2beta.FunctionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + functionserviceModule.v2beta.FunctionServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + functionserviceModule.v2beta.FunctionServiceClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - fallback: true, + it('has port', () => { + const port = functionserviceModule.v2beta.FunctionServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient(); + assert(client); }); - assert.strictEqual(client.functionServiceStub, undefined); - await client.initialize(); - assert(client.functionServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.functionServiceStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + await client.initialize(); + assert(client.functionServiceStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.functionServiceStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.functionServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.functionServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new functionserviceModule.v2beta.FunctionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + 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()); }); - 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 functionserviceModule.v2beta.FunctionServiceClient({ - 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); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new functionserviceModule.v2beta.FunctionServiceClient({ + 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); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('getFunction', () => { From 0c62a6813524488670a9da3225b037563b7c2fa0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 16:58:12 +0000 Subject: [PATCH 113/123] fix: change import long to require (#182) Source-Link: https://github.com/googleapis/synthtool/commit/d229a1258999f599a90a9b674a1c5541e00db588 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:74ab2b3c71ef27e6d8b69b1d0a0c9d31447777b79ac3cd4be82c265b45f37e5e --- .../google-cloud-functions/protos/protos.d.ts | 1754 +++- .../google-cloud-functions/protos/protos.js | 8923 ++++++++++++----- .../google-cloud-functions/protos/protos.json | 87 +- 3 files changed, 8011 insertions(+), 2753 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index d4641902871..6a3da1e7126 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import * as Long from "long"; +import Long = require("long"); import {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { @@ -204,77 +204,77 @@ export namespace google { namespace CloudFunctionsService { /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#listFunctions}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|listFunctions}. * @param error Error, if any * @param [response] ListFunctionsResponse */ type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v1.ListFunctionsResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#getFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|getFunction}. * @param error Error, if any * @param [response] CloudFunction */ type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v1.CloudFunction) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#createFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|createFunction}. * @param error Error, if any * @param [response] Operation */ type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#updateFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|updateFunction}. * @param error Error, if any * @param [response] Operation */ type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#deleteFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|deleteFunction}. * @param error Error, if any * @param [response] Operation */ type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#callFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|callFunction}. * @param error Error, if any * @param [response] CallFunctionResponse */ type CallFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v1.CallFunctionResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#generateUploadUrl}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|generateUploadUrl}. * @param error Error, if any * @param [response] GenerateUploadUrlResponse */ type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v1.GenerateUploadUrlResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#generateDownloadUrl}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|generateDownloadUrl}. * @param error Error, if any * @param [response] GenerateDownloadUrlResponse */ type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v1.GenerateDownloadUrlResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#setIamPolicy}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|setIamPolicy}. * @param error Error, if any * @param [response] Policy */ type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#getIamPolicy}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|getIamPolicy}. * @param error Error, if any * @param [response] Policy */ type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#testIamPermissions}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|testIamPermissions}. * @param error Error, if any * @param [response] TestIamPermissionsResponse */ @@ -567,6 +567,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloudFunction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace CloudFunction { @@ -688,6 +695,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceRepository + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a HttpsTrigger. */ @@ -784,6 +798,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpsTrigger + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace HttpsTrigger { @@ -902,6 +923,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventTrigger + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FailurePolicy. */ @@ -995,6 +1023,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FailurePolicy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FailurePolicy { @@ -1081,6 +1116,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Retry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -1200,6 +1242,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretEnvVar + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SecretVolume. */ @@ -1308,6 +1357,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretVolume + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SecretVolume { @@ -1406,6 +1462,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -1503,6 +1566,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateFunctionRequest. */ @@ -1599,6 +1669,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetFunctionRequest. */ @@ -1689,6 +1766,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListFunctionsRequest. */ @@ -1791,6 +1875,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFunctionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListFunctionsResponse. */ @@ -1893,6 +1984,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFunctionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteFunctionRequest. */ @@ -1983,6 +2081,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CallFunctionRequest. */ @@ -2079,6 +2184,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CallFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CallFunctionResponse. */ @@ -2181,6 +2293,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CallFunctionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateUploadUrlRequest. */ @@ -2277,6 +2396,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateUploadUrlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateUploadUrlResponse. */ @@ -2367,6 +2493,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateUploadUrlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateDownloadUrlRequest. */ @@ -2463,6 +2596,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateDownloadUrlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateDownloadUrlResponse. */ @@ -2553,6 +2693,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateDownloadUrlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** OperationType enum. */ @@ -2693,6 +2840,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadataV1 + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -2835,56 +2989,56 @@ export namespace google { namespace FunctionService { /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#getFunction}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|getFunction}. * @param error Error, if any * @param [response] Function */ type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v2.Function) => void; /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#listFunctions}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|listFunctions}. * @param error Error, if any * @param [response] ListFunctionsResponse */ type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v2.ListFunctionsResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#createFunction}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|createFunction}. * @param error Error, if any * @param [response] Operation */ type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#updateFunction}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|updateFunction}. * @param error Error, if any * @param [response] Operation */ type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#deleteFunction}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|deleteFunction}. * @param error Error, if any * @param [response] Operation */ type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateUploadUrl}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|generateUploadUrl}. * @param error Error, if any * @param [response] GenerateUploadUrlResponse */ type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2.GenerateUploadUrlResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateDownloadUrl}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|generateDownloadUrl}. * @param error Error, if any * @param [response] GenerateDownloadUrlResponse */ type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2.GenerateDownloadUrlResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#listRuntimes}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|listRuntimes}. * @param error Error, if any * @param [response] ListRuntimesResponse */ @@ -3040,6 +3194,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Function + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Function { @@ -3155,6 +3316,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StateMessage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace StateMessage { @@ -3268,6 +3436,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StorageSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RepoSource. */ @@ -3397,6 +3572,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RepoSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Source. */ @@ -3496,6 +3678,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Source + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SourceProvenance. */ @@ -3592,6 +3781,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceProvenance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BuildConfig. */ @@ -3724,6 +3920,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BuildConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceConfig. */ @@ -3898,6 +4101,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ServiceConfig { @@ -4024,6 +4234,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretEnvVar + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SecretVolume. */ @@ -4132,6 +4349,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretVolume + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SecretVolume { @@ -4230,6 +4454,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -4363,6 +4594,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventTrigger + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace EventTrigger { @@ -4475,6 +4713,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetFunctionRequest. */ @@ -4565,6 +4810,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListFunctionsRequest. */ @@ -4679,6 +4931,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFunctionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListFunctionsResponse. */ @@ -4781,6 +5040,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFunctionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CreateFunctionRequest. */ @@ -4883,6 +5149,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateFunctionRequest. */ @@ -4979,6 +5252,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteFunctionRequest. */ @@ -5069,6 +5349,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateUploadUrlRequest. */ @@ -5159,6 +5446,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateUploadUrlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateUploadUrlResponse. */ @@ -5255,6 +5549,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateUploadUrlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateDownloadUrlRequest. */ @@ -5345,6 +5646,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateDownloadUrlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateDownloadUrlResponse. */ @@ -5435,6 +5743,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateDownloadUrlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListRuntimesRequest. */ @@ -5531,6 +5846,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListRuntimesResponse. */ @@ -5621,6 +5943,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ListRuntimesResponse { @@ -5737,6 +6066,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Runtime + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** RuntimeStage enum. */ @@ -5887,6 +6223,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Stage. */ @@ -6007,6 +6350,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Stage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Stage { @@ -6171,56 +6521,56 @@ export namespace google { namespace FunctionService { /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#getFunction}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|getFunction}. * @param error Error, if any * @param [response] Function */ type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.Function) => void; /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#listFunctions}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|listFunctions}. * @param error Error, if any * @param [response] ListFunctionsResponse */ type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.ListFunctionsResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#createFunction}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|createFunction}. * @param error Error, if any * @param [response] Operation */ type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#updateFunction}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|updateFunction}. * @param error Error, if any * @param [response] Operation */ type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#deleteFunction}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|deleteFunction}. * @param error Error, if any * @param [response] Operation */ type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#generateUploadUrl}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|generateUploadUrl}. * @param error Error, if any * @param [response] GenerateUploadUrlResponse */ type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.GenerateUploadUrlResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#generateDownloadUrl}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|generateDownloadUrl}. * @param error Error, if any * @param [response] GenerateDownloadUrlResponse */ type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2alpha.GenerateDownloadUrlResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#listRuntimes}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|listRuntimes}. * @param error Error, if any * @param [response] ListRuntimesResponse */ @@ -6376,6 +6726,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Function + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Function { @@ -6491,6 +6848,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StateMessage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace StateMessage { @@ -6604,6 +6968,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StorageSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RepoSource. */ @@ -6733,6 +7104,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RepoSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Source. */ @@ -6832,6 +7210,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Source + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SourceProvenance. */ @@ -6928,6 +7313,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceProvenance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BuildConfig. */ @@ -7060,6 +7452,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BuildConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceConfig. */ @@ -7234,6 +7633,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ServiceConfig { @@ -7360,6 +7766,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretEnvVar + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SecretVolume. */ @@ -7468,6 +7881,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretVolume + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SecretVolume { @@ -7566,6 +7986,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -7699,6 +8126,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventTrigger + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace EventTrigger { @@ -7811,6 +8245,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetFunctionRequest. */ @@ -7901,6 +8342,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListFunctionsRequest. */ @@ -8015,6 +8463,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFunctionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListFunctionsResponse. */ @@ -8117,6 +8572,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFunctionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CreateFunctionRequest. */ @@ -8219,6 +8681,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateFunctionRequest. */ @@ -8315,6 +8784,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteFunctionRequest. */ @@ -8405,6 +8881,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateUploadUrlRequest. */ @@ -8495,6 +8978,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateUploadUrlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateUploadUrlResponse. */ @@ -8591,6 +9081,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateUploadUrlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateDownloadUrlRequest. */ @@ -8681,6 +9178,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateDownloadUrlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateDownloadUrlResponse. */ @@ -8771,6 +9275,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateDownloadUrlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListRuntimesRequest. */ @@ -8867,6 +9378,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListRuntimesResponse. */ @@ -8957,6 +9475,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ListRuntimesResponse { @@ -9073,6 +9598,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Runtime + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** RuntimeStage enum. */ @@ -9223,6 +9755,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Stage. */ @@ -9343,6 +9882,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Stage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Stage { @@ -9507,56 +10053,56 @@ export namespace google { namespace FunctionService { /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#getFunction}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|getFunction}. * @param error Error, if any * @param [response] Function */ type GetFunctionCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.Function) => void; /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#listFunctions}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|listFunctions}. * @param error Error, if any * @param [response] ListFunctionsResponse */ type ListFunctionsCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.ListFunctionsResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#createFunction}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|createFunction}. * @param error Error, if any * @param [response] Operation */ type CreateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#updateFunction}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|updateFunction}. * @param error Error, if any * @param [response] Operation */ type UpdateFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#deleteFunction}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|deleteFunction}. * @param error Error, if any * @param [response] Operation */ type DeleteFunctionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#generateUploadUrl}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|generateUploadUrl}. * @param error Error, if any * @param [response] GenerateUploadUrlResponse */ type GenerateUploadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.GenerateUploadUrlResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#generateDownloadUrl}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|generateDownloadUrl}. * @param error Error, if any * @param [response] GenerateDownloadUrlResponse */ type GenerateDownloadUrlCallback = (error: (Error|null), response?: google.cloud.functions.v2beta.GenerateDownloadUrlResponse) => void; /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#listRuntimes}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|listRuntimes}. * @param error Error, if any * @param [response] ListRuntimesResponse */ @@ -9712,6 +10258,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Function + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Function { @@ -9827,6 +10380,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StateMessage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace StateMessage { @@ -9940,6 +10500,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StorageSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a RepoSource. */ @@ -10069,6 +10636,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RepoSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Source. */ @@ -10168,6 +10742,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Source + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SourceProvenance. */ @@ -10264,6 +10845,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceProvenance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BuildConfig. */ @@ -10396,6 +10984,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BuildConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceConfig. */ @@ -10570,7 +11165,14 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; - } + + /** + * Gets the default type url for ServiceConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } namespace ServiceConfig { @@ -10696,6 +11298,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretEnvVar + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a SecretVolume. */ @@ -10804,6 +11413,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretVolume + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SecretVolume { @@ -10902,6 +11518,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SecretVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -11035,6 +11658,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventTrigger + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace EventTrigger { @@ -11147,6 +11777,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventFilter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetFunctionRequest. */ @@ -11237,6 +11874,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListFunctionsRequest. */ @@ -11351,6 +11995,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFunctionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListFunctionsResponse. */ @@ -11453,6 +12104,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListFunctionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CreateFunctionRequest. */ @@ -11555,6 +12213,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateFunctionRequest. */ @@ -11651,6 +12316,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteFunctionRequest. */ @@ -11741,6 +12413,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteFunctionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateUploadUrlRequest. */ @@ -11831,6 +12510,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateUploadUrlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateUploadUrlResponse. */ @@ -11927,6 +12613,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateUploadUrlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateDownloadUrlRequest. */ @@ -12017,6 +12710,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateDownloadUrlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GenerateDownloadUrlResponse. */ @@ -12107,6 +12807,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateDownloadUrlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListRuntimesRequest. */ @@ -12203,6 +12910,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListRuntimesResponse. */ @@ -12293,6 +13007,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRuntimesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ListRuntimesResponse { @@ -12409,6 +13130,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Runtime + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** RuntimeStage enum. */ @@ -12559,6 +13287,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Stage. */ @@ -12679,6 +13414,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Stage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace Stage { @@ -12803,6 +13545,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Http + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a HttpRule. */ @@ -12950,6 +13699,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CustomHttpPattern. */ @@ -13046,6 +13802,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomHttpPattern + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** FieldBehavior enum. */ @@ -13184,6 +13947,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ResourceDescriptor { @@ -13296,6 +14066,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -13390,6 +14167,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FileDescriptorProto. */ @@ -13430,6 +14214,9 @@ export namespace google { /** FileDescriptorProto syntax */ syntax?: (string|null); + + /** FileDescriptorProto edition */ + edition?: (string|null); } /** Represents a FileDescriptorProto. */ @@ -13477,6 +14264,9 @@ export namespace google { /** FileDescriptorProto syntax. */ public syntax: string; + /** FileDescriptorProto edition. */ + public edition: string; + /** * Creates a new FileDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -13546,6 +14336,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DescriptorProto. */ @@ -13690,6 +14487,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DescriptorProto { @@ -13794,6 +14598,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReservedRange. */ @@ -13890,6 +14701,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -13981,6 +14799,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FieldDescriptorProto. */ @@ -14131,6 +14956,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FieldDescriptorProto { @@ -14259,6 +15091,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumDescriptorProto. */ @@ -14373,6 +15212,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace EnumDescriptorProto { @@ -14471,6 +15317,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -14574,6 +15427,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceDescriptorProto. */ @@ -14676,6 +15536,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MethodDescriptorProto. */ @@ -14796,6 +15663,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FileOptions. */ @@ -15009,6 +15883,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FileOptions { @@ -15136,6 +16017,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FieldOptions. */ @@ -15153,6 +16041,9 @@ export namespace google { /** FieldOptions lazy */ lazy?: (boolean|null); + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + /** FieldOptions deprecated */ deprecated?: (boolean|null); @@ -15190,6 +16081,9 @@ export namespace google { /** FieldOptions lazy. */ public lazy: boolean; + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + /** FieldOptions deprecated. */ public deprecated: boolean; @@ -15268,6 +16162,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FieldOptions { @@ -15375,6 +16276,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumOptions. */ @@ -15477,6 +16385,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumValueOptions. */ @@ -15573,6 +16488,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceOptions. */ @@ -15675,6 +16597,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MethodOptions. */ @@ -15786,6 +16715,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace MethodOptions { @@ -15922,6 +16858,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UninterpretedOption + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace UninterpretedOption { @@ -16020,6 +16963,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NamePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -16111,6 +17061,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SourceCodeInfo { @@ -16227,6 +17184,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Location + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -16318,6 +17282,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace GeneratedCodeInfo { @@ -16336,6 +17307,9 @@ export namespace google { /** Annotation end */ end?: (number|null); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); } /** Represents an Annotation. */ @@ -16359,6 +17333,9 @@ export namespace google { /** Annotation end. */ public end: number; + /** Annotation semantic. */ + public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); + /** * Creates a new Annotation instance using the specified properties. * @param [properties] Properties to set @@ -16428,114 +17405,235 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Annotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } - } - /** Properties of an Any. */ - interface IAny { + namespace Annotation { - /** Any type_url */ - type_url?: (string|null); + /** Semantic enum. */ + enum Semantic { + NONE = 0, + SET = 1, + ALIAS = 2 + } + } + } - /** Any value */ - value?: (Uint8Array|string|null); + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); } - /** Represents an Any. */ - class Any implements IAny { + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { /** - * Constructs a new Any. + * Constructs a new FieldMask. * @param [properties] Properties to set */ - constructor(properties?: google.protobuf.IAny); - - /** Any type_url. */ - public type_url: string; + constructor(properties?: google.protobuf.IFieldMask); - /** Any value. */ - public value: (Uint8Array|string); + /** FieldMask paths. */ + public paths: string[]; /** - * Creates a new Any instance using the specified properties. + * Creates a new FieldMask instance using the specified properties. * @param [properties] Properties to set - * @returns Any instance + * @returns FieldMask instance */ - public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Any message from the specified reader or buffer. + * Decodes a FieldMask message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Any + * @returns FieldMask * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; /** - * Decodes an Any message from the specified reader or buffer, length delimited. + * Decodes a FieldMask message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Any + * @returns FieldMask * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; /** - * Verifies an Any message. + * Verifies a FieldMask message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Any message from a plain object. Also converts values to their respective internal types. + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Any + * @returns FieldMask */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; /** - * Creates a plain object from an Any message. Also converts values to other types if specified. - * @param message Any + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Any to JSON. + * Converts this FieldMask to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a Duration. */ - interface IDuration { + /** Properties of an Any. */ + interface IAny { - /** Duration seconds */ - seconds?: (number|Long|string|null); + /** Any type_url */ + type_url?: (string|null); - /** Duration nanos */ - nanos?: (number|null); - } + /** Any value */ + value?: (Uint8Array|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; + + /** + * Verifies an Any message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Any + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } /** Represents a Duration. */ class Duration implements IDuration { @@ -16621,6 +17719,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Duration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an Empty. */ @@ -16705,96 +17810,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; - } - - /** Properties of a FieldMask. */ - interface IFieldMask { - - /** FieldMask paths */ - paths?: (string[]|null); - } - - /** Represents a FieldMask. */ - class FieldMask implements IFieldMask { /** - * Constructs a new FieldMask. - * @param [properties] Properties to set + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url */ - constructor(properties?: google.protobuf.IFieldMask); - - /** FieldMask paths. */ - public paths: string[]; - - /** - * Creates a new FieldMask instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldMask instance - */ - public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; - - /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldMask message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; - - /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; - - /** - * Verifies a FieldMask message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldMask - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; - - /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @param message FieldMask - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldMask to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Timestamp. */ @@ -16891,6 +17913,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Timestamp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -16966,21 +17995,21 @@ export namespace google { namespace IAMPolicy { /** - * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|setIamPolicy}. * @param error Error, if any * @param [response] Policy */ type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|getIamPolicy}. * @param error Error, if any * @param [response] Policy */ type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * Callback as used by {@link google.iam.v1.IAMPolicy|testIamPermissions}. * @param error Error, if any * @param [response] TestIamPermissionsResponse */ @@ -16995,6 +18024,9 @@ export namespace google { /** SetIamPolicyRequest policy */ policy?: (google.iam.v1.IPolicy|null); + + /** SetIamPolicyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } /** Represents a SetIamPolicyRequest. */ @@ -17012,6 +18044,9 @@ export namespace google { /** SetIamPolicyRequest policy. */ public policy?: (google.iam.v1.IPolicy|null); + /** SetIamPolicyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + /** * Creates a new SetIamPolicyRequest instance using the specified properties. * @param [properties] Properties to set @@ -17081,6 +18116,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetIamPolicyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetIamPolicyRequest. */ @@ -17177,6 +18219,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetIamPolicyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TestIamPermissionsRequest. */ @@ -17273,6 +18322,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TestIamPermissionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TestIamPermissionsResponse. */ @@ -17363,6 +18419,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TestIamPermissionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetPolicyOptions. */ @@ -17453,6 +18516,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetPolicyOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Policy. */ @@ -17464,6 +18534,9 @@ export namespace google { /** Policy bindings */ bindings?: (google.iam.v1.IBinding[]|null); + /** Policy auditConfigs */ + auditConfigs?: (google.iam.v1.IAuditConfig[]|null); + /** Policy etag */ etag?: (Uint8Array|string|null); } @@ -17483,6 +18556,9 @@ export namespace google { /** Policy bindings. */ public bindings: google.iam.v1.IBinding[]; + /** Policy auditConfigs. */ + public auditConfigs: google.iam.v1.IAuditConfig[]; + /** Policy etag. */ public etag: (Uint8Array|string); @@ -17555,6 +18631,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Policy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Binding. */ @@ -17657,6 +18740,230 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Binding + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AuditConfig. */ + interface IAuditConfig { + + /** AuditConfig service */ + service?: (string|null); + + /** AuditConfig auditLogConfigs */ + auditLogConfigs?: (google.iam.v1.IAuditLogConfig[]|null); + } + + /** Represents an AuditConfig. */ + class AuditConfig implements IAuditConfig { + + /** + * Constructs a new AuditConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IAuditConfig); + + /** AuditConfig service. */ + public service: string; + + /** AuditConfig auditLogConfigs. */ + public auditLogConfigs: google.iam.v1.IAuditLogConfig[]; + + /** + * Creates a new AuditConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AuditConfig instance + */ + public static create(properties?: google.iam.v1.IAuditConfig): google.iam.v1.AuditConfig; + + /** + * Encodes the specified AuditConfig message. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @param message AuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AuditConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @param message AuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AuditConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.AuditConfig; + + /** + * Decodes an AuditConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.AuditConfig; + + /** + * Verifies an AuditConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AuditConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AuditConfig + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.AuditConfig; + + /** + * Creates a plain object from an AuditConfig message. Also converts values to other types if specified. + * @param message AuditConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.AuditConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AuditConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AuditConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AuditLogConfig. */ + interface IAuditLogConfig { + + /** AuditLogConfig logType */ + logType?: (google.iam.v1.AuditLogConfig.LogType|keyof typeof google.iam.v1.AuditLogConfig.LogType|null); + + /** AuditLogConfig exemptedMembers */ + exemptedMembers?: (string[]|null); + } + + /** Represents an AuditLogConfig. */ + class AuditLogConfig implements IAuditLogConfig { + + /** + * Constructs a new AuditLogConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IAuditLogConfig); + + /** AuditLogConfig logType. */ + public logType: (google.iam.v1.AuditLogConfig.LogType|keyof typeof google.iam.v1.AuditLogConfig.LogType); + + /** AuditLogConfig exemptedMembers. */ + public exemptedMembers: string[]; + + /** + * Creates a new AuditLogConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AuditLogConfig instance + */ + public static create(properties?: google.iam.v1.IAuditLogConfig): google.iam.v1.AuditLogConfig; + + /** + * Encodes the specified AuditLogConfig message. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @param message AuditLogConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IAuditLogConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AuditLogConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @param message AuditLogConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IAuditLogConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.AuditLogConfig; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.AuditLogConfig; + + /** + * Verifies an AuditLogConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AuditLogConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AuditLogConfig + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.AuditLogConfig; + + /** + * Creates a plain object from an AuditLogConfig message. Also converts values to other types if specified. + * @param message AuditLogConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.AuditLogConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AuditLogConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AuditLogConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AuditLogConfig { + + /** LogType enum. */ + enum LogType { + LOG_TYPE_UNSPECIFIED = 0, + ADMIN_READ = 1, + DATA_WRITE = 2, + DATA_READ = 3 + } } /** Properties of a PolicyDelta. */ @@ -17753,6 +19060,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PolicyDelta + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BindingDelta. */ @@ -17861,6 +19175,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BindingDelta + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace BindingDelta { @@ -17979,6 +19300,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AuditConfigDelta + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace AuditConfigDelta { @@ -18102,6 +19430,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Expr + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -18202,35 +19537,35 @@ export namespace google { namespace Operations { /** - * Callback as used by {@link google.longrunning.Operations#listOperations}. + * Callback as used by {@link google.longrunning.Operations|listOperations}. * @param error Error, if any * @param [response] ListOperationsResponse */ type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; /** - * Callback as used by {@link google.longrunning.Operations#getOperation}. + * Callback as used by {@link google.longrunning.Operations|getOperation}. * @param error Error, if any * @param [response] Operation */ type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. * @param error Error, if any * @param [response] Empty */ type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. * @param error Error, if any * @param [response] Empty */ type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; /** - * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * Callback as used by {@link google.longrunning.Operations|waitOperation}. * @param error Error, if any * @param [response] Operation */ @@ -18352,6 +19687,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Operation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetOperationRequest. */ @@ -18442,6 +19784,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListOperationsRequest. */ @@ -18550,6 +19899,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListOperationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListOperationsResponse. */ @@ -18646,6 +20002,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListOperationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CancelOperationRequest. */ @@ -18736,6 +20099,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CancelOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DeleteOperationRequest. */ @@ -18826,6 +20196,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a WaitOperationRequest. */ @@ -18922,6 +20299,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WaitOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an OperationInfo. */ @@ -19018,6 +20402,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -19124,6 +20515,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Status + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } } diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 78d62c3febc..311dc5061e0 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -99,7 +99,7 @@ }; /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#listFunctions}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|listFunctions}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef ListFunctionsCallback * @type {function} @@ -132,7 +132,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#getFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|getFunction}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef GetFunctionCallback * @type {function} @@ -165,7 +165,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#createFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|createFunction}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef CreateFunctionCallback * @type {function} @@ -198,7 +198,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#updateFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|updateFunction}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef UpdateFunctionCallback * @type {function} @@ -231,7 +231,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#deleteFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|deleteFunction}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef DeleteFunctionCallback * @type {function} @@ -264,7 +264,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#callFunction}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|callFunction}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef CallFunctionCallback * @type {function} @@ -297,7 +297,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#generateUploadUrl}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|generateUploadUrl}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef GenerateUploadUrlCallback * @type {function} @@ -330,7 +330,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#generateDownloadUrl}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|generateDownloadUrl}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef GenerateDownloadUrlCallback * @type {function} @@ -363,7 +363,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#setIamPolicy}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|setIamPolicy}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef SetIamPolicyCallback * @type {function} @@ -396,7 +396,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#getIamPolicy}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|getIamPolicy}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef GetIamPolicyCallback * @type {function} @@ -429,7 +429,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService#testIamPermissions}. + * Callback as used by {@link google.cloud.functions.v1.CloudFunctionsService|testIamPermissions}. * @memberof google.cloud.functions.v1.CloudFunctionsService * @typedef TestIamPermissionsCallback * @type {function} @@ -943,166 +943,199 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.sourceArchiveUrl = reader.string(); - break; - case 4: - message.sourceRepository = $root.google.cloud.functions.v1.SourceRepository.decode(reader, reader.uint32()); - break; - case 16: - message.sourceUploadUrl = reader.string(); - break; - case 5: - message.httpsTrigger = $root.google.cloud.functions.v1.HttpsTrigger.decode(reader, reader.uint32()); - break; - case 6: - message.eventTrigger = $root.google.cloud.functions.v1.EventTrigger.decode(reader, reader.uint32()); - break; - case 7: - message.status = reader.int32(); - break; - case 8: - message.entryPoint = reader.string(); - break; - case 19: - message.runtime = reader.string(); - break; - case 9: - message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 10: - message.availableMemoryMb = reader.int32(); - break; - case 11: - message.serviceAccountEmail = reader.string(); - break; - case 12: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 14: - message.versionId = reader.int64(); - break; - case 15: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.sourceArchiveUrl = reader.string(); + break; + } + case 4: { + message.sourceRepository = $root.google.cloud.functions.v1.SourceRepository.decode(reader, reader.uint32()); + break; + } + case 16: { + message.sourceUploadUrl = reader.string(); + break; + } + case 5: { + message.httpsTrigger = $root.google.cloud.functions.v1.HttpsTrigger.decode(reader, reader.uint32()); + break; + } + case 6: { + message.eventTrigger = $root.google.cloud.functions.v1.EventTrigger.decode(reader, reader.uint32()); + break; + } + case 7: { + message.status = reader.int32(); + break; + } + case 8: { + message.entryPoint = reader.string(); + break; + } + case 19: { + message.runtime = reader.string(); + break; + } + case 9: { + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 10: { + message.availableMemoryMb = reader.int32(); + break; + } + case 11: { + message.serviceAccountEmail = reader.string(); + break; + } + case 12: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 14: { + message.versionId = reader.int64(); + break; + } + case 15: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; } - message.labels[key] = value; - break; - case 17: - if (message.environmentVariables === $util.emptyObject) - message.environmentVariables = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 17: { + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.environmentVariables[key] = value; + break; } - message.environmentVariables[key] = value; - break; - case 28: - if (message.buildEnvironmentVariables === $util.emptyObject) - message.buildEnvironmentVariables = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 28: { + if (message.buildEnvironmentVariables === $util.emptyObject) + message.buildEnvironmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.buildEnvironmentVariables[key] = value; + break; + } + case 18: { + message.network = reader.string(); + break; + } + case 20: { + message.maxInstances = reader.int32(); + break; + } + case 32: { + message.minInstances = reader.int32(); + break; + } + case 22: { + message.vpcConnector = reader.string(); + break; + } + case 23: { + message.vpcConnectorEgressSettings = reader.int32(); + break; + } + case 24: { + message.ingressSettings = reader.int32(); + break; + } + case 25: { + message.kmsKeyName = reader.string(); + break; + } + case 26: { + message.buildWorkerPool = reader.string(); + break; + } + case 27: { + message.buildId = reader.string(); + break; + } + case 33: { + message.buildName = reader.string(); + break; + } + case 29: { + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v1.SecretEnvVar.decode(reader, reader.uint32())); + break; + } + case 30: { + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v1.SecretVolume.decode(reader, reader.uint32())); + break; + } + case 31: { + message.sourceToken = reader.string(); + break; + } + case 34: { + message.dockerRepository = reader.string(); + break; + } + case 35: { + message.dockerRegistry = reader.int32(); + break; } - message.buildEnvironmentVariables[key] = value; - break; - case 18: - message.network = reader.string(); - break; - case 20: - message.maxInstances = reader.int32(); - break; - case 32: - message.minInstances = reader.int32(); - break; - case 22: - message.vpcConnector = reader.string(); - break; - case 23: - message.vpcConnectorEgressSettings = reader.int32(); - break; - case 24: - message.ingressSettings = reader.int32(); - break; - case 25: - message.kmsKeyName = reader.string(); - break; - case 26: - message.buildWorkerPool = reader.string(); - break; - case 27: - message.buildId = reader.string(); - break; - case 33: - message.buildName = reader.string(); - break; - case 29: - if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) - message.secretEnvironmentVariables = []; - message.secretEnvironmentVariables.push($root.google.cloud.functions.v1.SecretEnvVar.decode(reader, reader.uint32())); - break; - case 30: - if (!(message.secretVolumes && message.secretVolumes.length)) - message.secretVolumes = []; - message.secretVolumes.push($root.google.cloud.functions.v1.SecretVolume.decode(reader, reader.uint32())); - break; - case 31: - message.sourceToken = reader.string(); - break; - case 34: - message.dockerRepository = reader.string(); - break; - case 35: - message.dockerRegistry = reader.int32(); - break; default: reader.skipType(tag & 7); break; @@ -1688,6 +1721,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CloudFunction + * @function getTypeUrl + * @memberof google.cloud.functions.v1.CloudFunction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloudFunction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.CloudFunction"; + }; + /** * VpcConnectorEgressSettings enum. * @name google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings @@ -1844,12 +1892,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.url = reader.string(); - break; - case 2: - message.deployedUrl = reader.string(); - break; + case 1: { + message.url = reader.string(); + break; + } + case 2: { + message.deployedUrl = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -1948,6 +1998,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SourceRepository + * @function getTypeUrl + * @memberof google.cloud.functions.v1.SourceRepository + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceRepository.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.SourceRepository"; + }; + return SourceRepository; })(); @@ -2054,12 +2119,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.url = reader.string(); - break; - case 2: - message.securityLevel = reader.int32(); - break; + case 1: { + message.url = reader.string(); + break; + } + case 2: { + message.securityLevel = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -2176,6 +2243,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HttpsTrigger + * @function getTypeUrl + * @memberof google.cloud.functions.v1.HttpsTrigger + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpsTrigger.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.HttpsTrigger"; + }; + /** * SecurityLevel enum. * @name google.cloud.functions.v1.HttpsTrigger.SecurityLevel @@ -2320,18 +2402,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.eventType = reader.string(); - break; - case 2: - message.resource = reader.string(); - break; - case 3: - message.service = reader.string(); - break; - case 5: - message.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.decode(reader, reader.uint32()); - break; + case 1: { + message.eventType = reader.string(); + break; + } + case 2: { + message.resource = reader.string(); + break; + } + case 3: { + message.service = reader.string(); + break; + } + case 5: { + message.failurePolicy = $root.google.cloud.functions.v1.FailurePolicy.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -2451,6 +2537,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EventTrigger + * @function getTypeUrl + * @memberof google.cloud.functions.v1.EventTrigger + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventTrigger.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.EventTrigger"; + }; + return EventTrigger; })(); @@ -2560,9 +2661,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.decode(reader, reader.uint32()); - break; + case 1: { + message.retry = $root.google.cloud.functions.v1.FailurePolicy.Retry.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -2662,6 +2764,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FailurePolicy + * @function getTypeUrl + * @memberof google.cloud.functions.v1.FailurePolicy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FailurePolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.FailurePolicy"; + }; + FailurePolicy.Retry = (function() { /** @@ -2819,6 +2936,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Retry + * @function getTypeUrl + * @memberof google.cloud.functions.v1.FailurePolicy.Retry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Retry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.FailurePolicy.Retry"; + }; + return Retry; })(); @@ -2972,18 +3104,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.secret = reader.string(); - break; - case 4: - message.version = reader.string(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.secret = reader.string(); + break; + } + case 4: { + message.version = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -3098,6 +3234,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretEnvVar + * @function getTypeUrl + * @memberof google.cloud.functions.v1.SecretEnvVar + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretEnvVar.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.SecretEnvVar"; + }; + return SecretEnvVar; })(); @@ -3228,20 +3379,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mountPath = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.secret = reader.string(); - break; - case 4: - if (!(message.versions && message.versions.length)) - message.versions = []; - message.versions.push($root.google.cloud.functions.v1.SecretVolume.SecretVersion.decode(reader, reader.uint32())); - break; + case 1: { + message.mountPath = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.secret = reader.string(); + break; + } + case 4: { + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v1.SecretVolume.SecretVersion.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -3374,6 +3529,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretVolume + * @function getTypeUrl + * @memberof google.cloud.functions.v1.SecretVolume + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretVolume.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.SecretVolume"; + }; + SecretVolume.SecretVersion = (function() { /** @@ -3477,12 +3647,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.version = reader.string(); - break; - case 2: - message.path = reader.string(); - break; + case 1: { + message.version = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -3581,6 +3753,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretVersion + * @function getTypeUrl + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.SecretVolume.SecretVersion"; + }; + return SecretVersion; })(); @@ -3690,12 +3877,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.location = reader.string(); - break; - case 2: - message["function"] = $root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32()); - break; + case 1: { + message.location = reader.string(); + break; + } + case 2: { + message["function"] = $root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -3799,6 +3988,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v1.CreateFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.CreateFunctionRequest"; + }; + return CreateFunctionRequest; })(); @@ -3905,12 +4109,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message["function"] = $root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message["function"] = $root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -4019,6 +4225,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v1.UpdateFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.UpdateFunctionRequest"; + }; + return UpdateFunctionRequest; })(); @@ -4114,9 +4335,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -4206,6 +4428,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v1.GetFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.GetFunctionRequest"; + }; + return GetFunctionRequest; })(); @@ -4323,15 +4560,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -4438,6 +4678,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListFunctionsRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v1.ListFunctionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFunctionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.ListFunctionsRequest"; + }; + return ListFunctionsRequest; })(); @@ -4559,19 +4814,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.functions && message.functions.length)) - message.functions = []; - message.functions.push($root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; - case 3: - if (!(message.unreachable && message.unreachable.length)) - message.unreachable = []; - message.unreachable.push(reader.string()); - break; + case 1: { + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v1.CloudFunction.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -4708,6 +4966,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListFunctionsResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v1.ListFunctionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFunctionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.ListFunctionsResponse"; + }; + return ListFunctionsResponse; })(); @@ -4803,9 +5076,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -4895,6 +5169,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v1.DeleteFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.DeleteFunctionRequest"; + }; + return DeleteFunctionRequest; })(); @@ -5001,12 +5290,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.data = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.data = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -5105,6 +5396,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CallFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v1.CallFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CallFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.CallFunctionRequest"; + }; + return CallFunctionRequest; })(); @@ -5222,15 +5528,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.executionId = reader.string(); - break; - case 2: - message.result = reader.string(); - break; - case 3: - message.error = reader.string(); - break; + case 1: { + message.executionId = reader.string(); + break; + } + case 2: { + message.result = reader.string(); + break; + } + case 3: { + message.error = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -5337,6 +5646,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CallFunctionResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v1.CallFunctionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CallFunctionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.CallFunctionResponse"; + }; + return CallFunctionResponse; })(); @@ -5443,12 +5767,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.kmsKeyName = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.kmsKeyName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -5547,6 +5873,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateUploadUrlRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v1.GenerateUploadUrlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateUploadUrlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.GenerateUploadUrlRequest"; + }; + return GenerateUploadUrlRequest; })(); @@ -5642,9 +5983,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uploadUrl = reader.string(); - break; + case 1: { + message.uploadUrl = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -5734,6 +6076,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateUploadUrlResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v1.GenerateUploadUrlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateUploadUrlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.GenerateUploadUrlResponse"; + }; + return GenerateUploadUrlResponse; })(); @@ -5840,12 +6197,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.versionId = reader.uint64(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.versionId = reader.uint64(); + break; + } default: reader.skipType(tag & 7); break; @@ -5958,6 +6317,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateDownloadUrlRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v1.GenerateDownloadUrlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateDownloadUrlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.GenerateDownloadUrlRequest"; + }; + return GenerateDownloadUrlRequest; })(); @@ -6053,9 +6427,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.downloadUrl = reader.string(); - break; + case 1: { + message.downloadUrl = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -6145,6 +6520,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateDownloadUrlResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v1.GenerateDownloadUrlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateDownloadUrlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.GenerateDownloadUrlResponse"; + }; + return GenerateDownloadUrlResponse; })(); @@ -6335,30 +6725,38 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.target = reader.string(); - break; - case 2: - message.type = reader.int32(); - break; - case 3: - message.request = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 4: - message.versionId = reader.int64(); - break; - case 5: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.buildId = reader.string(); - break; - case 7: - message.sourceToken = reader.string(); - break; - case 8: - message.buildName = reader.string(); - break; + case 1: { + message.target = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + message.request = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 4: { + message.versionId = reader.int64(); + break; + } + case 5: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.buildId = reader.string(); + break; + } + case 7: { + message.sourceToken = reader.string(); + break; + } + case 8: { + message.buildName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -6552,6 +6950,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OperationMetadataV1 + * @function getTypeUrl + * @memberof google.cloud.functions.v1.OperationMetadataV1 + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadataV1.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v1.OperationMetadataV1"; + }; + return OperationMetadataV1; })(); @@ -6600,7 +7013,7 @@ }; /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#getFunction}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|getFunction}. * @memberof google.cloud.functions.v2.FunctionService * @typedef GetFunctionCallback * @type {function} @@ -6633,7 +7046,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#listFunctions}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|listFunctions}. * @memberof google.cloud.functions.v2.FunctionService * @typedef ListFunctionsCallback * @type {function} @@ -6666,7 +7079,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#createFunction}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|createFunction}. * @memberof google.cloud.functions.v2.FunctionService * @typedef CreateFunctionCallback * @type {function} @@ -6699,7 +7112,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#updateFunction}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|updateFunction}. * @memberof google.cloud.functions.v2.FunctionService * @typedef UpdateFunctionCallback * @type {function} @@ -6732,7 +7145,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#deleteFunction}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|deleteFunction}. * @memberof google.cloud.functions.v2.FunctionService * @typedef DeleteFunctionCallback * @type {function} @@ -6765,7 +7178,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateUploadUrl}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|generateUploadUrl}. * @memberof google.cloud.functions.v2.FunctionService * @typedef GenerateUploadUrlCallback * @type {function} @@ -6798,7 +7211,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#generateDownloadUrl}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|generateDownloadUrl}. * @memberof google.cloud.functions.v2.FunctionService * @typedef GenerateDownloadUrlCallback * @type {function} @@ -6831,7 +7244,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2.FunctionService#listRuntimes}. + * Callback as used by {@link google.cloud.functions.v2.FunctionService|listRuntimes}. * @memberof google.cloud.functions.v2.FunctionService * @typedef ListRuntimesCallback * @type {function} @@ -7077,57 +7490,67 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 10: - message.environment = reader.int32(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.buildConfig = $root.google.cloud.functions.v2.BuildConfig.decode(reader, reader.uint32()); - break; - case 4: - message.serviceConfig = $root.google.cloud.functions.v2.ServiceConfig.decode(reader, reader.uint32()); - break; - case 5: - message.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.decode(reader, reader.uint32()); - break; - case 6: - message.state = reader.int32(); - break; - case 7: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.name = reader.string(); + break; + } + case 10: { + message.environment = reader.int32(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.buildConfig = $root.google.cloud.functions.v2.BuildConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.serviceConfig = $root.google.cloud.functions.v2.ServiceConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.decode(reader, reader.uint32()); + break; + } + case 6: { + message.state = reader.int32(); + break; + } + case 7: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; + } + case 9: { + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2.StateMessage.decode(reader, reader.uint32())); + break; } - message.labels[key] = value; - break; - case 9: - if (!(message.stateMessages && message.stateMessages.length)) - message.stateMessages = []; - message.stateMessages.push($root.google.cloud.functions.v2.StateMessage.decode(reader, reader.uint32())); - break; default: reader.skipType(tag & 7); break; @@ -7394,6 +7817,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Function + * @function getTypeUrl + * @memberof google.cloud.functions.v2.Function + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Function.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.Function"; + }; + /** * State enum. * @name google.cloud.functions.v2.Function.State @@ -7533,15 +7971,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.severity = reader.int32(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.message = reader.string(); - break; + case 1: { + message.severity = reader.int32(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.message = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -7671,6 +8112,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for StateMessage + * @function getTypeUrl + * @memberof google.cloud.functions.v2.StateMessage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StateMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.StateMessage"; + }; + /** * Severity enum. * @name google.cloud.functions.v2.StateMessage.Severity @@ -7806,15 +8262,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.bucket = reader.string(); - break; - case 2: - message.object = reader.string(); - break; - case 3: - message.generation = reader.int64(); - break; + case 1: { + message.bucket = reader.string(); + break; + } + case 2: { + message.object = reader.string(); + break; + } + case 3: { + message.generation = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -7935,6 +8394,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for StorageSource + * @function getTypeUrl + * @memberof google.cloud.functions.v2.StorageSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StorageSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.StorageSource"; + }; + return StorageSource; })(); @@ -8110,27 +8584,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: - message.branchName = reader.string(); - break; - case 4: - message.tagName = reader.string(); - break; - case 5: - message.commitSha = reader.string(); - break; - case 1: - message.projectId = reader.string(); - break; - case 2: - message.repoName = reader.string(); - break; - case 6: - message.dir = reader.string(); - break; - case 7: - message.invertRegex = reader.bool(); - break; + case 3: { + message.branchName = reader.string(); + break; + } + case 4: { + message.tagName = reader.string(); + break; + } + case 5: { + message.commitSha = reader.string(); + break; + } + case 1: { + message.projectId = reader.string(); + break; + } + case 2: { + message.repoName = reader.string(); + break; + } + case 6: { + message.dir = reader.string(); + break; + } + case 7: { + message.invertRegex = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -8286,6 +8767,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RepoSource + * @function getTypeUrl + * @memberof google.cloud.functions.v2.RepoSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RepoSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.RepoSource"; + }; + return RepoSource; })(); @@ -8406,12 +8902,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.storageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); - break; - case 2: - message.repoSource = $root.google.cloud.functions.v2.RepoSource.decode(reader, reader.uint32()); - break; + case 1: { + message.storageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.repoSource = $root.google.cloud.functions.v2.RepoSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -8531,6 +9029,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Source + * @function getTypeUrl + * @memberof google.cloud.functions.v2.Source + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Source.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.Source"; + }; + return Source; })(); @@ -8637,12 +9150,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resolvedStorageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); - break; - case 2: - message.resolvedRepoSource = $root.google.cloud.functions.v2.RepoSource.decode(reader, reader.uint32()); - break; + case 1: { + message.resolvedStorageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.resolvedRepoSource = $root.google.cloud.functions.v2.RepoSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -8751,6 +9266,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SourceProvenance + * @function getTypeUrl + * @memberof google.cloud.functions.v2.SourceProvenance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceProvenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.SourceProvenance"; + }; + return SourceProvenance; })(); @@ -8925,49 +9455,57 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.build = reader.string(); - break; - case 2: - message.runtime = reader.string(); - break; - case 3: - message.entryPoint = reader.string(); - break; - case 4: - message.source = $root.google.cloud.functions.v2.Source.decode(reader, reader.uint32()); - break; - case 8: - message.sourceProvenance = $root.google.cloud.functions.v2.SourceProvenance.decode(reader, reader.uint32()); - break; - case 5: - message.workerPool = reader.string(); - break; - case 6: - if (message.environmentVariables === $util.emptyObject) - message.environmentVariables = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.build = reader.string(); + break; + } + case 2: { + message.runtime = reader.string(); + break; + } + case 3: { + message.entryPoint = reader.string(); + break; + } + case 4: { + message.source = $root.google.cloud.functions.v2.Source.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sourceProvenance = $root.google.cloud.functions.v2.SourceProvenance.decode(reader, reader.uint32()); + break; + } + case 5: { + message.workerPool = reader.string(); + break; + } + case 6: { + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.environmentVariables[key] = value; + break; + } + case 7: { + message.dockerRepository = reader.string(); + break; } - message.environmentVariables[key] = value; - break; - case 7: - message.dockerRepository = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -9139,6 +9677,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BuildConfig + * @function getTypeUrl + * @memberof google.cloud.functions.v2.BuildConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BuildConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.BuildConfig"; + }; + return BuildConfig; })(); @@ -9394,74 +9947,89 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.service = reader.string(); - break; - case 2: - message.timeoutSeconds = reader.int32(); - break; - case 13: - message.availableMemory = reader.string(); - break; - case 4: - if (message.environmentVariables === $util.emptyObject) - message.environmentVariables = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.service = reader.string(); + break; + } + case 2: { + message.timeoutSeconds = reader.int32(); + break; + } + case 13: { + message.availableMemory = reader.string(); + break; + } + case 4: { + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.environmentVariables[key] = value; + break; + } + case 5: { + message.maxInstanceCount = reader.int32(); + break; + } + case 12: { + message.minInstanceCount = reader.int32(); + break; + } + case 6: { + message.vpcConnector = reader.string(); + break; + } + case 7: { + message.vpcConnectorEgressSettings = reader.int32(); + break; + } + case 8: { + message.ingressSettings = reader.int32(); + break; + } + case 9: { + message.uri = reader.string(); + break; + } + case 10: { + message.serviceAccountEmail = reader.string(); + break; + } + case 16: { + message.allTrafficOnLatestRevision = reader.bool(); + break; + } + case 17: { + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v2.SecretEnvVar.decode(reader, reader.uint32())); + break; + } + case 19: { + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v2.SecretVolume.decode(reader, reader.uint32())); + break; + } + case 18: { + message.revision = reader.string(); + break; } - message.environmentVariables[key] = value; - break; - case 5: - message.maxInstanceCount = reader.int32(); - break; - case 12: - message.minInstanceCount = reader.int32(); - break; - case 6: - message.vpcConnector = reader.string(); - break; - case 7: - message.vpcConnectorEgressSettings = reader.int32(); - break; - case 8: - message.ingressSettings = reader.int32(); - break; - case 9: - message.uri = reader.string(); - break; - case 10: - message.serviceAccountEmail = reader.string(); - break; - case 16: - message.allTrafficOnLatestRevision = reader.bool(); - break; - case 17: - if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) - message.secretEnvironmentVariables = []; - message.secretEnvironmentVariables.push($root.google.cloud.functions.v2.SecretEnvVar.decode(reader, reader.uint32())); - break; - case 19: - if (!(message.secretVolumes && message.secretVolumes.length)) - message.secretVolumes = []; - message.secretVolumes.push($root.google.cloud.functions.v2.SecretVolume.decode(reader, reader.uint32())); - break; - case 18: - message.revision = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -9756,6 +10324,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceConfig + * @function getTypeUrl + * @memberof google.cloud.functions.v2.ServiceConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.ServiceConfig"; + }; + /** * VpcConnectorEgressSettings enum. * @name google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings @@ -9918,18 +10501,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.secret = reader.string(); - break; - case 4: - message.version = reader.string(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.secret = reader.string(); + break; + } + case 4: { + message.version = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -10044,6 +10631,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretEnvVar + * @function getTypeUrl + * @memberof google.cloud.functions.v2.SecretEnvVar + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretEnvVar.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.SecretEnvVar"; + }; + return SecretEnvVar; })(); @@ -10174,20 +10776,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mountPath = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.secret = reader.string(); - break; - case 4: - if (!(message.versions && message.versions.length)) - message.versions = []; - message.versions.push($root.google.cloud.functions.v2.SecretVolume.SecretVersion.decode(reader, reader.uint32())); - break; + case 1: { + message.mountPath = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.secret = reader.string(); + break; + } + case 4: { + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v2.SecretVolume.SecretVersion.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -10320,6 +10926,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretVolume + * @function getTypeUrl + * @memberof google.cloud.functions.v2.SecretVolume + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretVolume.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.SecretVolume"; + }; + SecretVolume.SecretVersion = (function() { /** @@ -10423,12 +11044,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.version = reader.string(); - break; - case 2: - message.path = reader.string(); - break; + case 1: { + message.version = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -10527,6 +11150,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretVersion + * @function getTypeUrl + * @memberof google.cloud.functions.v2.SecretVolume.SecretVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.SecretVolume.SecretVersion"; + }; + return SecretVersion; })(); @@ -10704,32 +11342,40 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.trigger = reader.string(); - break; - case 2: - message.triggerRegion = reader.string(); - break; - case 3: - message.eventType = reader.string(); - break; - case 4: - if (!(message.eventFilters && message.eventFilters.length)) - message.eventFilters = []; - message.eventFilters.push($root.google.cloud.functions.v2.EventFilter.decode(reader, reader.uint32())); - break; - case 5: - message.pubsubTopic = reader.string(); - break; - case 6: - message.serviceAccountEmail = reader.string(); - break; - case 7: - message.retryPolicy = reader.int32(); - break; - case 8: - message.channel = reader.string(); - break; + case 1: { + message.trigger = reader.string(); + break; + } + case 2: { + message.triggerRegion = reader.string(); + break; + } + case 3: { + message.eventType = reader.string(); + break; + } + case 4: { + if (!(message.eventFilters && message.eventFilters.length)) + message.eventFilters = []; + message.eventFilters.push($root.google.cloud.functions.v2.EventFilter.decode(reader, reader.uint32())); + break; + } + case 5: { + message.pubsubTopic = reader.string(); + break; + } + case 6: { + message.serviceAccountEmail = reader.string(); + break; + } + case 7: { + message.retryPolicy = reader.int32(); + break; + } + case 8: { + message.channel = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -10912,6 +11558,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EventTrigger + * @function getTypeUrl + * @memberof google.cloud.functions.v2.EventTrigger + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventTrigger.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.EventTrigger"; + }; + /** * RetryPolicy enum. * @name google.cloud.functions.v2.EventTrigger.RetryPolicy @@ -11045,15 +11706,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attribute = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - case 3: - message.operator = reader.string(); - break; + case 1: { + message.attribute = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + case 3: { + message.operator = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -11160,6 +11824,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EventFilter + * @function getTypeUrl + * @memberof google.cloud.functions.v2.EventFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.EventFilter"; + }; + return EventFilter; })(); @@ -11255,9 +11934,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -11347,6 +12027,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2.GetFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.GetFunctionRequest"; + }; + return GetFunctionRequest; })(); @@ -11486,21 +12181,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.orderBy = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -11623,6 +12323,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListFunctionsRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2.ListFunctionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFunctionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.ListFunctionsRequest"; + }; + return ListFunctionsRequest; })(); @@ -11744,19 +12459,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.functions && message.functions.length)) - message.functions = []; - message.functions.push($root.google.cloud.functions.v2.Function.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; - case 3: - if (!(message.unreachable && message.unreachable.length)) - message.unreachable = []; - message.unreachable.push(reader.string()); - break; + case 1: { + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v2.Function.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -11893,6 +12611,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListFunctionsResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2.ListFunctionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFunctionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.ListFunctionsResponse"; + }; + return ListFunctionsResponse; })(); @@ -12010,15 +12743,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message["function"] = $root.google.cloud.functions.v2.Function.decode(reader, reader.uint32()); - break; - case 3: - message.functionId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message["function"] = $root.google.cloud.functions.v2.Function.decode(reader, reader.uint32()); + break; + } + case 3: { + message.functionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -12130,6 +12866,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2.CreateFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.CreateFunctionRequest"; + }; + return CreateFunctionRequest; })(); @@ -12236,12 +12987,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message["function"] = $root.google.cloud.functions.v2.Function.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message["function"] = $root.google.cloud.functions.v2.Function.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12350,6 +13103,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2.UpdateFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.UpdateFunctionRequest"; + }; + return UpdateFunctionRequest; })(); @@ -12445,9 +13213,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -12537,6 +13306,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2.DeleteFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.DeleteFunctionRequest"; + }; + return DeleteFunctionRequest; })(); @@ -12632,9 +13416,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -12724,6 +13509,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateUploadUrlRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2.GenerateUploadUrlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateUploadUrlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.GenerateUploadUrlRequest"; + }; + return GenerateUploadUrlRequest; })(); @@ -12830,12 +13630,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uploadUrl = reader.string(); - break; - case 2: - message.storageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); - break; + case 1: { + message.uploadUrl = reader.string(); + break; + } + case 2: { + message.storageSource = $root.google.cloud.functions.v2.StorageSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12939,6 +13741,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateUploadUrlResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2.GenerateUploadUrlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateUploadUrlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.GenerateUploadUrlResponse"; + }; + return GenerateUploadUrlResponse; })(); @@ -13034,9 +13851,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -13126,6 +13944,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateDownloadUrlRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2.GenerateDownloadUrlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateDownloadUrlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.GenerateDownloadUrlRequest"; + }; + return GenerateDownloadUrlRequest; })(); @@ -13221,9 +14054,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.downloadUrl = reader.string(); - break; + case 1: { + message.downloadUrl = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -13313,6 +14147,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateDownloadUrlResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2.GenerateDownloadUrlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateDownloadUrlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.GenerateDownloadUrlResponse"; + }; + return GenerateDownloadUrlResponse; })(); @@ -13419,12 +14268,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -13523,6 +14374,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListRuntimesRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2.ListRuntimesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRuntimesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.ListRuntimesRequest"; + }; + return ListRuntimesRequest; })(); @@ -13620,11 +14486,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.runtimes && message.runtimes.length)) - message.runtimes = []; - message.runtimes.push($root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.runtimes && message.runtimes.length)) + message.runtimes = []; + message.runtimes.push($root.google.cloud.functions.v2.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -13731,6 +14598,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListRuntimesResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2.ListRuntimesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRuntimesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.ListRuntimesResponse"; + }; + ListRuntimesResponse.Runtime = (function() { /** @@ -13869,23 +14751,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 5: - message.displayName = reader.string(); - break; - case 2: - message.stage = reader.int32(); - break; - case 3: - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push(reader.string()); - break; - case 4: - message.environment = reader.int32(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 5: { + message.displayName = reader.string(); + break; + } + case 2: { + message.stage = reader.int32(); + break; + } + case 3: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push(reader.string()); + break; + } + case 4: { + message.environment = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -14077,6 +14964,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Runtime + * @function getTypeUrl + * @memberof google.cloud.functions.v2.ListRuntimesResponse.Runtime + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Runtime.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.ListRuntimesResponse.Runtime"; + }; + return Runtime; })(); @@ -14289,35 +15191,44 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.target = reader.string(); - break; - case 4: - message.verb = reader.string(); - break; - case 5: - message.statusDetail = reader.string(); - break; - case 6: - message.cancelRequested = reader.bool(); - break; - case 7: - message.apiVersion = reader.string(); - break; - case 8: - message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 9: - if (!(message.stages && message.stages.length)) - message.stages = []; - message.stages.push($root.google.cloud.functions.v2.Stage.decode(reader, reader.uint32())); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.target = reader.string(); + break; + } + case 4: { + message.verb = reader.string(); + break; + } + case 5: { + message.statusDetail = reader.string(); + break; + } + case 6: { + message.cancelRequested = reader.bool(); + break; + } + case 7: { + message.apiVersion = reader.string(); + break; + } + case 8: { + message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.stages && message.stages.length)) + message.stages = []; + message.stages.push($root.google.cloud.functions.v2.Stage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -14505,6 +15416,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OperationMetadata + * @function getTypeUrl + * @memberof google.cloud.functions.v2.OperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.OperationMetadata"; + }; + return OperationMetadata; })(); @@ -14657,26 +15583,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.int32(); - break; - case 2: - message.message = reader.string(); - break; - case 3: - message.state = reader.int32(); - break; - case 4: - message.resource = reader.string(); - break; - case 5: - message.resourceUri = reader.string(); - break; - case 6: - if (!(message.stateMessages && message.stateMessages.length)) - message.stateMessages = []; - message.stateMessages.push($root.google.cloud.functions.v2.StateMessage.decode(reader, reader.uint32())); - break; + case 1: { + message.name = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.resource = reader.string(); + break; + } + case 5: { + message.resourceUri = reader.string(); + break; + } + case 6: { + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2.StateMessage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -14886,6 +15818,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Stage + * @function getTypeUrl + * @memberof google.cloud.functions.v2.Stage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Stage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2.Stage"; + }; + /** * Name enum. * @name google.cloud.functions.v2.Stage.Name @@ -14976,7 +15923,7 @@ }; /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#getFunction}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|getFunction}. * @memberof google.cloud.functions.v2alpha.FunctionService * @typedef GetFunctionCallback * @type {function} @@ -15009,7 +15956,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#listFunctions}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|listFunctions}. * @memberof google.cloud.functions.v2alpha.FunctionService * @typedef ListFunctionsCallback * @type {function} @@ -15042,7 +15989,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#createFunction}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|createFunction}. * @memberof google.cloud.functions.v2alpha.FunctionService * @typedef CreateFunctionCallback * @type {function} @@ -15075,7 +16022,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#updateFunction}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|updateFunction}. * @memberof google.cloud.functions.v2alpha.FunctionService * @typedef UpdateFunctionCallback * @type {function} @@ -15108,7 +16055,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#deleteFunction}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|deleteFunction}. * @memberof google.cloud.functions.v2alpha.FunctionService * @typedef DeleteFunctionCallback * @type {function} @@ -15141,7 +16088,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#generateUploadUrl}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|generateUploadUrl}. * @memberof google.cloud.functions.v2alpha.FunctionService * @typedef GenerateUploadUrlCallback * @type {function} @@ -15174,7 +16121,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#generateDownloadUrl}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|generateDownloadUrl}. * @memberof google.cloud.functions.v2alpha.FunctionService * @typedef GenerateDownloadUrlCallback * @type {function} @@ -15207,7 +16154,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService#listRuntimes}. + * Callback as used by {@link google.cloud.functions.v2alpha.FunctionService|listRuntimes}. * @memberof google.cloud.functions.v2alpha.FunctionService * @typedef ListRuntimesCallback * @type {function} @@ -15453,57 +16400,67 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 10: - message.environment = reader.int32(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.buildConfig = $root.google.cloud.functions.v2alpha.BuildConfig.decode(reader, reader.uint32()); - break; - case 4: - message.serviceConfig = $root.google.cloud.functions.v2alpha.ServiceConfig.decode(reader, reader.uint32()); - break; - case 5: - message.eventTrigger = $root.google.cloud.functions.v2alpha.EventTrigger.decode(reader, reader.uint32()); - break; - case 6: - message.state = reader.int32(); - break; - case 7: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.name = reader.string(); + break; + } + case 10: { + message.environment = reader.int32(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.buildConfig = $root.google.cloud.functions.v2alpha.BuildConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.serviceConfig = $root.google.cloud.functions.v2alpha.ServiceConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.eventTrigger = $root.google.cloud.functions.v2alpha.EventTrigger.decode(reader, reader.uint32()); + break; + } + case 6: { + message.state = reader.int32(); + break; + } + case 7: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; + } + case 9: { + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2alpha.StateMessage.decode(reader, reader.uint32())); + break; } - message.labels[key] = value; - break; - case 9: - if (!(message.stateMessages && message.stateMessages.length)) - message.stateMessages = []; - message.stateMessages.push($root.google.cloud.functions.v2alpha.StateMessage.decode(reader, reader.uint32())); - break; default: reader.skipType(tag & 7); break; @@ -15770,6 +16727,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Function + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.Function + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Function.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.Function"; + }; + /** * State enum. * @name google.cloud.functions.v2alpha.Function.State @@ -15909,15 +16881,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.severity = reader.int32(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.message = reader.string(); - break; + case 1: { + message.severity = reader.int32(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.message = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -16047,6 +17022,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for StateMessage + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.StateMessage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StateMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.StateMessage"; + }; + /** * Severity enum. * @name google.cloud.functions.v2alpha.StateMessage.Severity @@ -16182,15 +17172,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.bucket = reader.string(); - break; - case 2: - message.object = reader.string(); - break; - case 3: - message.generation = reader.int64(); - break; + case 1: { + message.bucket = reader.string(); + break; + } + case 2: { + message.object = reader.string(); + break; + } + case 3: { + message.generation = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -16311,6 +17304,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for StorageSource + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.StorageSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StorageSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.StorageSource"; + }; + return StorageSource; })(); @@ -16486,27 +17494,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: - message.branchName = reader.string(); - break; - case 4: - message.tagName = reader.string(); - break; - case 5: - message.commitSha = reader.string(); - break; - case 1: - message.projectId = reader.string(); - break; - case 2: - message.repoName = reader.string(); - break; - case 6: - message.dir = reader.string(); - break; - case 7: - message.invertRegex = reader.bool(); - break; + case 3: { + message.branchName = reader.string(); + break; + } + case 4: { + message.tagName = reader.string(); + break; + } + case 5: { + message.commitSha = reader.string(); + break; + } + case 1: { + message.projectId = reader.string(); + break; + } + case 2: { + message.repoName = reader.string(); + break; + } + case 6: { + message.dir = reader.string(); + break; + } + case 7: { + message.invertRegex = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -16662,6 +17677,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RepoSource + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.RepoSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RepoSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.RepoSource"; + }; + return RepoSource; })(); @@ -16782,12 +17812,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); - break; - case 2: - message.repoSource = $root.google.cloud.functions.v2alpha.RepoSource.decode(reader, reader.uint32()); - break; + case 1: { + message.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.repoSource = $root.google.cloud.functions.v2alpha.RepoSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -16907,6 +17939,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Source + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.Source + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Source.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.Source"; + }; + return Source; })(); @@ -17013,12 +18060,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resolvedStorageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); - break; - case 2: - message.resolvedRepoSource = $root.google.cloud.functions.v2alpha.RepoSource.decode(reader, reader.uint32()); - break; + case 1: { + message.resolvedStorageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.resolvedRepoSource = $root.google.cloud.functions.v2alpha.RepoSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -17127,6 +18176,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SourceProvenance + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.SourceProvenance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceProvenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.SourceProvenance"; + }; + return SourceProvenance; })(); @@ -17301,49 +18365,57 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.build = reader.string(); - break; - case 2: - message.runtime = reader.string(); - break; - case 3: - message.entryPoint = reader.string(); - break; - case 4: - message.source = $root.google.cloud.functions.v2alpha.Source.decode(reader, reader.uint32()); - break; - case 8: - message.sourceProvenance = $root.google.cloud.functions.v2alpha.SourceProvenance.decode(reader, reader.uint32()); - break; - case 5: - message.workerPool = reader.string(); - break; - case 6: - if (message.environmentVariables === $util.emptyObject) - message.environmentVariables = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.build = reader.string(); + break; + } + case 2: { + message.runtime = reader.string(); + break; + } + case 3: { + message.entryPoint = reader.string(); + break; + } + case 4: { + message.source = $root.google.cloud.functions.v2alpha.Source.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sourceProvenance = $root.google.cloud.functions.v2alpha.SourceProvenance.decode(reader, reader.uint32()); + break; + } + case 5: { + message.workerPool = reader.string(); + break; + } + case 6: { + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.environmentVariables[key] = value; + break; + } + case 7: { + message.dockerRepository = reader.string(); + break; } - message.environmentVariables[key] = value; - break; - case 7: - message.dockerRepository = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -17515,6 +18587,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BuildConfig + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.BuildConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BuildConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.BuildConfig"; + }; + return BuildConfig; })(); @@ -17770,74 +18857,89 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.service = reader.string(); - break; - case 2: - message.timeoutSeconds = reader.int32(); - break; - case 13: - message.availableMemory = reader.string(); - break; - case 4: - if (message.environmentVariables === $util.emptyObject) - message.environmentVariables = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.service = reader.string(); + break; + } + case 2: { + message.timeoutSeconds = reader.int32(); + break; + } + case 13: { + message.availableMemory = reader.string(); + break; + } + case 4: { + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.environmentVariables[key] = value; + break; + } + case 5: { + message.maxInstanceCount = reader.int32(); + break; + } + case 12: { + message.minInstanceCount = reader.int32(); + break; + } + case 6: { + message.vpcConnector = reader.string(); + break; + } + case 7: { + message.vpcConnectorEgressSettings = reader.int32(); + break; + } + case 8: { + message.ingressSettings = reader.int32(); + break; + } + case 9: { + message.uri = reader.string(); + break; + } + case 10: { + message.serviceAccountEmail = reader.string(); + break; + } + case 16: { + message.allTrafficOnLatestRevision = reader.bool(); + break; + } + case 17: { + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v2alpha.SecretEnvVar.decode(reader, reader.uint32())); + break; + } + case 19: { + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v2alpha.SecretVolume.decode(reader, reader.uint32())); + break; + } + case 18: { + message.revision = reader.string(); + break; } - message.environmentVariables[key] = value; - break; - case 5: - message.maxInstanceCount = reader.int32(); - break; - case 12: - message.minInstanceCount = reader.int32(); - break; - case 6: - message.vpcConnector = reader.string(); - break; - case 7: - message.vpcConnectorEgressSettings = reader.int32(); - break; - case 8: - message.ingressSettings = reader.int32(); - break; - case 9: - message.uri = reader.string(); - break; - case 10: - message.serviceAccountEmail = reader.string(); - break; - case 16: - message.allTrafficOnLatestRevision = reader.bool(); - break; - case 17: - if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) - message.secretEnvironmentVariables = []; - message.secretEnvironmentVariables.push($root.google.cloud.functions.v2alpha.SecretEnvVar.decode(reader, reader.uint32())); - break; - case 19: - if (!(message.secretVolumes && message.secretVolumes.length)) - message.secretVolumes = []; - message.secretVolumes.push($root.google.cloud.functions.v2alpha.SecretVolume.decode(reader, reader.uint32())); - break; - case 18: - message.revision = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -18132,6 +19234,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceConfig + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.ServiceConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.ServiceConfig"; + }; + /** * VpcConnectorEgressSettings enum. * @name google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings @@ -18294,18 +19411,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.secret = reader.string(); - break; - case 4: - message.version = reader.string(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.secret = reader.string(); + break; + } + case 4: { + message.version = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -18420,6 +19541,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretEnvVar + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.SecretEnvVar + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretEnvVar.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.SecretEnvVar"; + }; + return SecretEnvVar; })(); @@ -18550,20 +19686,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mountPath = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.secret = reader.string(); - break; - case 4: - if (!(message.versions && message.versions.length)) - message.versions = []; - message.versions.push($root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion.decode(reader, reader.uint32())); - break; + case 1: { + message.mountPath = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.secret = reader.string(); + break; + } + case 4: { + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v2alpha.SecretVolume.SecretVersion.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -18696,6 +19836,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretVolume + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.SecretVolume + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretVolume.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.SecretVolume"; + }; + SecretVolume.SecretVersion = (function() { /** @@ -18799,12 +19954,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.version = reader.string(); - break; - case 2: - message.path = reader.string(); - break; + case 1: { + message.version = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -18903,6 +20060,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretVersion + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.SecretVolume.SecretVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.SecretVolume.SecretVersion"; + }; + return SecretVersion; })(); @@ -19080,32 +20252,40 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.trigger = reader.string(); - break; - case 2: - message.triggerRegion = reader.string(); - break; - case 3: - message.eventType = reader.string(); - break; - case 4: - if (!(message.eventFilters && message.eventFilters.length)) - message.eventFilters = []; - message.eventFilters.push($root.google.cloud.functions.v2alpha.EventFilter.decode(reader, reader.uint32())); - break; - case 5: - message.pubsubTopic = reader.string(); - break; - case 6: - message.serviceAccountEmail = reader.string(); - break; - case 7: - message.retryPolicy = reader.int32(); - break; - case 8: - message.channel = reader.string(); - break; + case 1: { + message.trigger = reader.string(); + break; + } + case 2: { + message.triggerRegion = reader.string(); + break; + } + case 3: { + message.eventType = reader.string(); + break; + } + case 4: { + if (!(message.eventFilters && message.eventFilters.length)) + message.eventFilters = []; + message.eventFilters.push($root.google.cloud.functions.v2alpha.EventFilter.decode(reader, reader.uint32())); + break; + } + case 5: { + message.pubsubTopic = reader.string(); + break; + } + case 6: { + message.serviceAccountEmail = reader.string(); + break; + } + case 7: { + message.retryPolicy = reader.int32(); + break; + } + case 8: { + message.channel = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -19288,6 +20468,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EventTrigger + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.EventTrigger + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventTrigger.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.EventTrigger"; + }; + /** * RetryPolicy enum. * @name google.cloud.functions.v2alpha.EventTrigger.RetryPolicy @@ -19421,15 +20616,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attribute = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - case 3: - message.operator = reader.string(); - break; + case 1: { + message.attribute = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + case 3: { + message.operator = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -19536,6 +20734,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EventFilter + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.EventFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.EventFilter"; + }; + return EventFilter; })(); @@ -19631,9 +20844,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -19723,6 +20937,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.GetFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.GetFunctionRequest"; + }; + return GetFunctionRequest; })(); @@ -19862,21 +21091,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.orderBy = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -19999,6 +21233,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListFunctionsRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.ListFunctionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFunctionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.ListFunctionsRequest"; + }; + return ListFunctionsRequest; })(); @@ -20120,19 +21369,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.functions && message.functions.length)) - message.functions = []; - message.functions.push($root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; - case 3: - if (!(message.unreachable && message.unreachable.length)) - message.unreachable = []; - message.unreachable.push(reader.string()); - break; + case 1: { + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -20269,6 +21521,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListFunctionsResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.ListFunctionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFunctionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.ListFunctionsResponse"; + }; + return ListFunctionsResponse; })(); @@ -20386,15 +21653,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message["function"] = $root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32()); - break; - case 3: - message.functionId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message["function"] = $root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32()); + break; + } + case 3: { + message.functionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -20506,6 +21776,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.CreateFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.CreateFunctionRequest"; + }; + return CreateFunctionRequest; })(); @@ -20612,12 +21897,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message["function"] = $root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message["function"] = $root.google.cloud.functions.v2alpha.Function.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -20726,6 +22013,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.UpdateFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.UpdateFunctionRequest"; + }; + return UpdateFunctionRequest; })(); @@ -20821,9 +22123,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -20913,6 +22216,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.DeleteFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.DeleteFunctionRequest"; + }; + return DeleteFunctionRequest; })(); @@ -21008,9 +22326,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -21100,6 +22419,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateUploadUrlRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateUploadUrlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.GenerateUploadUrlRequest"; + }; + return GenerateUploadUrlRequest; })(); @@ -21206,12 +22540,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uploadUrl = reader.string(); - break; - case 2: - message.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); - break; + case 1: { + message.uploadUrl = reader.string(); + break; + } + case 2: { + message.storageSource = $root.google.cloud.functions.v2alpha.StorageSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -21315,6 +22651,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateUploadUrlResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.GenerateUploadUrlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateUploadUrlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.GenerateUploadUrlResponse"; + }; + return GenerateUploadUrlResponse; })(); @@ -21410,9 +22761,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -21502,6 +22854,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateDownloadUrlRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateDownloadUrlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.GenerateDownloadUrlRequest"; + }; + return GenerateDownloadUrlRequest; })(); @@ -21597,9 +22964,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.downloadUrl = reader.string(); - break; + case 1: { + message.downloadUrl = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -21689,6 +23057,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateDownloadUrlResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.GenerateDownloadUrlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateDownloadUrlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.GenerateDownloadUrlResponse"; + }; + return GenerateDownloadUrlResponse; })(); @@ -21795,12 +23178,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -21899,6 +23284,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListRuntimesRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.ListRuntimesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRuntimesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.ListRuntimesRequest"; + }; + return ListRuntimesRequest; })(); @@ -21996,11 +23396,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.runtimes && message.runtimes.length)) - message.runtimes = []; - message.runtimes.push($root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.runtimes && message.runtimes.length)) + message.runtimes = []; + message.runtimes.push($root.google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -22107,6 +23508,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListRuntimesResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRuntimesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.ListRuntimesResponse"; + }; + ListRuntimesResponse.Runtime = (function() { /** @@ -22245,23 +23661,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 5: - message.displayName = reader.string(); - break; - case 2: - message.stage = reader.int32(); - break; - case 3: - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push(reader.string()); - break; - case 4: - message.environment = reader.int32(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 5: { + message.displayName = reader.string(); + break; + } + case 2: { + message.stage = reader.int32(); + break; + } + case 3: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push(reader.string()); + break; + } + case 4: { + message.environment = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -22453,6 +23874,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Runtime + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Runtime.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.ListRuntimesResponse.Runtime"; + }; + return Runtime; })(); @@ -22665,35 +24101,44 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.target = reader.string(); - break; - case 4: - message.verb = reader.string(); - break; - case 5: - message.statusDetail = reader.string(); - break; - case 6: - message.cancelRequested = reader.bool(); - break; - case 7: - message.apiVersion = reader.string(); - break; - case 8: - message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 9: - if (!(message.stages && message.stages.length)) - message.stages = []; - message.stages.push($root.google.cloud.functions.v2alpha.Stage.decode(reader, reader.uint32())); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.target = reader.string(); + break; + } + case 4: { + message.verb = reader.string(); + break; + } + case 5: { + message.statusDetail = reader.string(); + break; + } + case 6: { + message.cancelRequested = reader.bool(); + break; + } + case 7: { + message.apiVersion = reader.string(); + break; + } + case 8: { + message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.stages && message.stages.length)) + message.stages = []; + message.stages.push($root.google.cloud.functions.v2alpha.Stage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -22881,6 +24326,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OperationMetadata + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.OperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.OperationMetadata"; + }; + return OperationMetadata; })(); @@ -23033,26 +24493,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.int32(); - break; - case 2: - message.message = reader.string(); - break; - case 3: - message.state = reader.int32(); - break; - case 4: - message.resource = reader.string(); - break; - case 5: - message.resourceUri = reader.string(); - break; - case 6: - if (!(message.stateMessages && message.stateMessages.length)) - message.stateMessages = []; - message.stateMessages.push($root.google.cloud.functions.v2alpha.StateMessage.decode(reader, reader.uint32())); - break; + case 1: { + message.name = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.resource = reader.string(); + break; + } + case 5: { + message.resourceUri = reader.string(); + break; + } + case 6: { + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2alpha.StateMessage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -23262,6 +24728,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Stage + * @function getTypeUrl + * @memberof google.cloud.functions.v2alpha.Stage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Stage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2alpha.Stage"; + }; + /** * Name enum. * @name google.cloud.functions.v2alpha.Stage.Name @@ -23352,7 +24833,7 @@ }; /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#getFunction}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|getFunction}. * @memberof google.cloud.functions.v2beta.FunctionService * @typedef GetFunctionCallback * @type {function} @@ -23385,7 +24866,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#listFunctions}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|listFunctions}. * @memberof google.cloud.functions.v2beta.FunctionService * @typedef ListFunctionsCallback * @type {function} @@ -23418,7 +24899,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#createFunction}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|createFunction}. * @memberof google.cloud.functions.v2beta.FunctionService * @typedef CreateFunctionCallback * @type {function} @@ -23451,7 +24932,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#updateFunction}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|updateFunction}. * @memberof google.cloud.functions.v2beta.FunctionService * @typedef UpdateFunctionCallback * @type {function} @@ -23484,7 +24965,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#deleteFunction}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|deleteFunction}. * @memberof google.cloud.functions.v2beta.FunctionService * @typedef DeleteFunctionCallback * @type {function} @@ -23517,7 +24998,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#generateUploadUrl}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|generateUploadUrl}. * @memberof google.cloud.functions.v2beta.FunctionService * @typedef GenerateUploadUrlCallback * @type {function} @@ -23550,7 +25031,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#generateDownloadUrl}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|generateDownloadUrl}. * @memberof google.cloud.functions.v2beta.FunctionService * @typedef GenerateDownloadUrlCallback * @type {function} @@ -23583,7 +25064,7 @@ */ /** - * Callback as used by {@link google.cloud.functions.v2beta.FunctionService#listRuntimes}. + * Callback as used by {@link google.cloud.functions.v2beta.FunctionService|listRuntimes}. * @memberof google.cloud.functions.v2beta.FunctionService * @typedef ListRuntimesCallback * @type {function} @@ -23829,57 +25310,67 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 10: - message.environment = reader.int32(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.buildConfig = $root.google.cloud.functions.v2beta.BuildConfig.decode(reader, reader.uint32()); - break; - case 4: - message.serviceConfig = $root.google.cloud.functions.v2beta.ServiceConfig.decode(reader, reader.uint32()); - break; - case 5: - message.eventTrigger = $root.google.cloud.functions.v2beta.EventTrigger.decode(reader, reader.uint32()); - break; - case 6: - message.state = reader.int32(); - break; - case 7: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 8: - if (message.labels === $util.emptyObject) - message.labels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.name = reader.string(); + break; + } + case 10: { + message.environment = reader.int32(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.buildConfig = $root.google.cloud.functions.v2beta.BuildConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.serviceConfig = $root.google.cloud.functions.v2beta.ServiceConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.eventTrigger = $root.google.cloud.functions.v2beta.EventTrigger.decode(reader, reader.uint32()); + break; + } + case 6: { + message.state = reader.int32(); + break; + } + case 7: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.labels[key] = value; + break; + } + case 9: { + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2beta.StateMessage.decode(reader, reader.uint32())); + break; } - message.labels[key] = value; - break; - case 9: - if (!(message.stateMessages && message.stateMessages.length)) - message.stateMessages = []; - message.stateMessages.push($root.google.cloud.functions.v2beta.StateMessage.decode(reader, reader.uint32())); - break; default: reader.skipType(tag & 7); break; @@ -24146,6 +25637,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Function + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.Function + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Function.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.Function"; + }; + /** * State enum. * @name google.cloud.functions.v2beta.Function.State @@ -24285,15 +25791,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.severity = reader.int32(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.message = reader.string(); - break; + case 1: { + message.severity = reader.int32(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.message = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -24423,6 +25932,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for StateMessage + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.StateMessage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StateMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.StateMessage"; + }; + /** * Severity enum. * @name google.cloud.functions.v2beta.StateMessage.Severity @@ -24558,15 +26082,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.bucket = reader.string(); - break; - case 2: - message.object = reader.string(); - break; - case 3: - message.generation = reader.int64(); - break; + case 1: { + message.bucket = reader.string(); + break; + } + case 2: { + message.object = reader.string(); + break; + } + case 3: { + message.generation = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -24687,6 +26214,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for StorageSource + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.StorageSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StorageSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.StorageSource"; + }; + return StorageSource; })(); @@ -24862,27 +26404,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 3: - message.branchName = reader.string(); - break; - case 4: - message.tagName = reader.string(); - break; - case 5: - message.commitSha = reader.string(); - break; - case 1: - message.projectId = reader.string(); - break; - case 2: - message.repoName = reader.string(); - break; - case 6: - message.dir = reader.string(); - break; - case 7: - message.invertRegex = reader.bool(); - break; + case 3: { + message.branchName = reader.string(); + break; + } + case 4: { + message.tagName = reader.string(); + break; + } + case 5: { + message.commitSha = reader.string(); + break; + } + case 1: { + message.projectId = reader.string(); + break; + } + case 2: { + message.repoName = reader.string(); + break; + } + case 6: { + message.dir = reader.string(); + break; + } + case 7: { + message.invertRegex = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -25038,6 +26587,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RepoSource + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.RepoSource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RepoSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.RepoSource"; + }; + return RepoSource; })(); @@ -25158,12 +26722,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.storageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); - break; - case 2: - message.repoSource = $root.google.cloud.functions.v2beta.RepoSource.decode(reader, reader.uint32()); - break; + case 1: { + message.storageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.repoSource = $root.google.cloud.functions.v2beta.RepoSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -25283,6 +26849,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Source + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.Source + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Source.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.Source"; + }; + return Source; })(); @@ -25389,12 +26970,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resolvedStorageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); - break; - case 2: - message.resolvedRepoSource = $root.google.cloud.functions.v2beta.RepoSource.decode(reader, reader.uint32()); - break; + case 1: { + message.resolvedStorageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.resolvedRepoSource = $root.google.cloud.functions.v2beta.RepoSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -25503,6 +27086,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SourceProvenance + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.SourceProvenance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceProvenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.SourceProvenance"; + }; + return SourceProvenance; })(); @@ -25677,49 +27275,57 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.build = reader.string(); - break; - case 2: - message.runtime = reader.string(); - break; - case 3: - message.entryPoint = reader.string(); - break; - case 4: - message.source = $root.google.cloud.functions.v2beta.Source.decode(reader, reader.uint32()); - break; - case 8: - message.sourceProvenance = $root.google.cloud.functions.v2beta.SourceProvenance.decode(reader, reader.uint32()); - break; - case 5: - message.workerPool = reader.string(); - break; - case 6: - if (message.environmentVariables === $util.emptyObject) - message.environmentVariables = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.build = reader.string(); + break; + } + case 2: { + message.runtime = reader.string(); + break; + } + case 3: { + message.entryPoint = reader.string(); + break; + } + case 4: { + message.source = $root.google.cloud.functions.v2beta.Source.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sourceProvenance = $root.google.cloud.functions.v2beta.SourceProvenance.decode(reader, reader.uint32()); + break; + } + case 5: { + message.workerPool = reader.string(); + break; + } + case 6: { + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.environmentVariables[key] = value; + break; + } + case 7: { + message.dockerRepository = reader.string(); + break; } - message.environmentVariables[key] = value; - break; - case 7: - message.dockerRepository = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -25891,6 +27497,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BuildConfig + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.BuildConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BuildConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.BuildConfig"; + }; + return BuildConfig; })(); @@ -26146,74 +27767,89 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.service = reader.string(); - break; - case 2: - message.timeoutSeconds = reader.int32(); - break; - case 13: - message.availableMemory = reader.string(); - break; - case 4: - if (message.environmentVariables === $util.emptyObject) - message.environmentVariables = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; + case 1: { + message.service = reader.string(); + break; + } + case 2: { + message.timeoutSeconds = reader.int32(); + break; + } + case 13: { + message.availableMemory = reader.string(); + break; + } + case 4: { + if (message.environmentVariables === $util.emptyObject) + message.environmentVariables = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } } + message.environmentVariables[key] = value; + break; + } + case 5: { + message.maxInstanceCount = reader.int32(); + break; + } + case 12: { + message.minInstanceCount = reader.int32(); + break; + } + case 6: { + message.vpcConnector = reader.string(); + break; + } + case 7: { + message.vpcConnectorEgressSettings = reader.int32(); + break; + } + case 8: { + message.ingressSettings = reader.int32(); + break; + } + case 9: { + message.uri = reader.string(); + break; + } + case 10: { + message.serviceAccountEmail = reader.string(); + break; + } + case 16: { + message.allTrafficOnLatestRevision = reader.bool(); + break; + } + case 17: { + if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) + message.secretEnvironmentVariables = []; + message.secretEnvironmentVariables.push($root.google.cloud.functions.v2beta.SecretEnvVar.decode(reader, reader.uint32())); + break; + } + case 19: { + if (!(message.secretVolumes && message.secretVolumes.length)) + message.secretVolumes = []; + message.secretVolumes.push($root.google.cloud.functions.v2beta.SecretVolume.decode(reader, reader.uint32())); + break; + } + case 18: { + message.revision = reader.string(); + break; } - message.environmentVariables[key] = value; - break; - case 5: - message.maxInstanceCount = reader.int32(); - break; - case 12: - message.minInstanceCount = reader.int32(); - break; - case 6: - message.vpcConnector = reader.string(); - break; - case 7: - message.vpcConnectorEgressSettings = reader.int32(); - break; - case 8: - message.ingressSettings = reader.int32(); - break; - case 9: - message.uri = reader.string(); - break; - case 10: - message.serviceAccountEmail = reader.string(); - break; - case 16: - message.allTrafficOnLatestRevision = reader.bool(); - break; - case 17: - if (!(message.secretEnvironmentVariables && message.secretEnvironmentVariables.length)) - message.secretEnvironmentVariables = []; - message.secretEnvironmentVariables.push($root.google.cloud.functions.v2beta.SecretEnvVar.decode(reader, reader.uint32())); - break; - case 19: - if (!(message.secretVolumes && message.secretVolumes.length)) - message.secretVolumes = []; - message.secretVolumes.push($root.google.cloud.functions.v2beta.SecretVolume.decode(reader, reader.uint32())); - break; - case 18: - message.revision = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -26508,6 +28144,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceConfig + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.ServiceConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.ServiceConfig"; + }; + /** * VpcConnectorEgressSettings enum. * @name google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings @@ -26670,18 +28321,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.secret = reader.string(); - break; - case 4: - message.version = reader.string(); - break; + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.secret = reader.string(); + break; + } + case 4: { + message.version = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -26796,6 +28451,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretEnvVar + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.SecretEnvVar + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretEnvVar.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.SecretEnvVar"; + }; + return SecretEnvVar; })(); @@ -26926,20 +28596,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.mountPath = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.secret = reader.string(); - break; - case 4: - if (!(message.versions && message.versions.length)) - message.versions = []; - message.versions.push($root.google.cloud.functions.v2beta.SecretVolume.SecretVersion.decode(reader, reader.uint32())); - break; + case 1: { + message.mountPath = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.secret = reader.string(); + break; + } + case 4: { + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.functions.v2beta.SecretVolume.SecretVersion.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -27072,6 +28746,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretVolume + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.SecretVolume + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretVolume.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.SecretVolume"; + }; + SecretVolume.SecretVersion = (function() { /** @@ -27175,12 +28864,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.version = reader.string(); - break; - case 2: - message.path = reader.string(); - break; + case 1: { + message.version = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -27279,6 +28970,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SecretVersion + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.SecretVolume.SecretVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SecretVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.SecretVolume.SecretVersion"; + }; + return SecretVersion; })(); @@ -27456,32 +29162,40 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.trigger = reader.string(); - break; - case 2: - message.triggerRegion = reader.string(); - break; - case 3: - message.eventType = reader.string(); - break; - case 4: - if (!(message.eventFilters && message.eventFilters.length)) - message.eventFilters = []; - message.eventFilters.push($root.google.cloud.functions.v2beta.EventFilter.decode(reader, reader.uint32())); - break; - case 5: - message.pubsubTopic = reader.string(); - break; - case 6: - message.serviceAccountEmail = reader.string(); - break; - case 7: - message.retryPolicy = reader.int32(); - break; - case 8: - message.channel = reader.string(); - break; + case 1: { + message.trigger = reader.string(); + break; + } + case 2: { + message.triggerRegion = reader.string(); + break; + } + case 3: { + message.eventType = reader.string(); + break; + } + case 4: { + if (!(message.eventFilters && message.eventFilters.length)) + message.eventFilters = []; + message.eventFilters.push($root.google.cloud.functions.v2beta.EventFilter.decode(reader, reader.uint32())); + break; + } + case 5: { + message.pubsubTopic = reader.string(); + break; + } + case 6: { + message.serviceAccountEmail = reader.string(); + break; + } + case 7: { + message.retryPolicy = reader.int32(); + break; + } + case 8: { + message.channel = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -27664,6 +29378,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EventTrigger + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.EventTrigger + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventTrigger.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.EventTrigger"; + }; + /** * RetryPolicy enum. * @name google.cloud.functions.v2beta.EventTrigger.RetryPolicy @@ -27797,15 +29526,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.attribute = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - case 3: - message.operator = reader.string(); - break; + case 1: { + message.attribute = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + case 3: { + message.operator = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -27912,6 +29644,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EventFilter + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.EventFilter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventFilter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.EventFilter"; + }; + return EventFilter; })(); @@ -28007,9 +29754,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -28099,6 +29847,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.GetFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.GetFunctionRequest"; + }; + return GetFunctionRequest; })(); @@ -28238,21 +30001,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.filter = reader.string(); - break; - case 5: - message.orderBy = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -28375,6 +30143,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListFunctionsRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.ListFunctionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFunctionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.ListFunctionsRequest"; + }; + return ListFunctionsRequest; })(); @@ -28496,19 +30279,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.functions && message.functions.length)) - message.functions = []; - message.functions.push($root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; - case 3: - if (!(message.unreachable && message.unreachable.length)) - message.unreachable = []; - message.unreachable.push(reader.string()); - break; + case 1: { + if (!(message.functions && message.functions.length)) + message.functions = []; + message.functions.push($root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -28645,6 +30431,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListFunctionsResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.ListFunctionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListFunctionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.ListFunctionsResponse"; + }; + return ListFunctionsResponse; })(); @@ -28762,15 +30563,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message["function"] = $root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32()); - break; - case 3: - message.functionId = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message["function"] = $root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32()); + break; + } + case 3: { + message.functionId = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -28882,6 +30686,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.CreateFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.CreateFunctionRequest"; + }; + return CreateFunctionRequest; })(); @@ -28988,12 +30807,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message["function"] = $root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32()); - break; - case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message["function"] = $root.google.cloud.functions.v2beta.Function.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -29102,6 +30923,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.UpdateFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.UpdateFunctionRequest"; + }; + return UpdateFunctionRequest; })(); @@ -29197,9 +31033,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -29289,6 +31126,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteFunctionRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.DeleteFunctionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteFunctionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.DeleteFunctionRequest"; + }; + return DeleteFunctionRequest; })(); @@ -29384,9 +31236,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -29476,6 +31329,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateUploadUrlRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateUploadUrlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.GenerateUploadUrlRequest"; + }; + return GenerateUploadUrlRequest; })(); @@ -29582,12 +31450,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uploadUrl = reader.string(); - break; - case 2: - message.storageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); - break; + case 1: { + message.uploadUrl = reader.string(); + break; + } + case 2: { + message.storageSource = $root.google.cloud.functions.v2beta.StorageSource.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -29691,6 +31561,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateUploadUrlResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.GenerateUploadUrlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateUploadUrlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.GenerateUploadUrlResponse"; + }; + return GenerateUploadUrlResponse; })(); @@ -29786,9 +31671,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -29878,6 +31764,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateDownloadUrlRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateDownloadUrlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.GenerateDownloadUrlRequest"; + }; + return GenerateDownloadUrlRequest; })(); @@ -29973,9 +31874,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.downloadUrl = reader.string(); - break; + case 1: { + message.downloadUrl = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -30065,6 +31967,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GenerateDownloadUrlResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.GenerateDownloadUrlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateDownloadUrlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.GenerateDownloadUrlResponse"; + }; + return GenerateDownloadUrlResponse; })(); @@ -30171,12 +32088,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.filter = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -30275,6 +32194,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListRuntimesRequest + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.ListRuntimesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRuntimesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.ListRuntimesRequest"; + }; + return ListRuntimesRequest; })(); @@ -30372,11 +32306,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.runtimes && message.runtimes.length)) - message.runtimes = []; - message.runtimes.push($root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.runtimes && message.runtimes.length)) + message.runtimes = []; + message.runtimes.push($root.google.cloud.functions.v2beta.ListRuntimesResponse.Runtime.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -30483,6 +32418,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListRuntimesResponse + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRuntimesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.ListRuntimesResponse"; + }; + ListRuntimesResponse.Runtime = (function() { /** @@ -30621,23 +32571,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 5: - message.displayName = reader.string(); - break; - case 2: - message.stage = reader.int32(); - break; - case 3: - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push(reader.string()); - break; - case 4: - message.environment = reader.int32(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 5: { + message.displayName = reader.string(); + break; + } + case 2: { + message.stage = reader.int32(); + break; + } + case 3: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push(reader.string()); + break; + } + case 4: { + message.environment = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -30829,6 +32784,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Runtime + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.ListRuntimesResponse.Runtime + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Runtime.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.ListRuntimesResponse.Runtime"; + }; + return Runtime; })(); @@ -31041,35 +33011,44 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.target = reader.string(); - break; - case 4: - message.verb = reader.string(); - break; - case 5: - message.statusDetail = reader.string(); - break; - case 6: - message.cancelRequested = reader.bool(); - break; - case 7: - message.apiVersion = reader.string(); - break; - case 8: - message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 9: - if (!(message.stages && message.stages.length)) - message.stages = []; - message.stages.push($root.google.cloud.functions.v2beta.Stage.decode(reader, reader.uint32())); - break; + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.target = reader.string(); + break; + } + case 4: { + message.verb = reader.string(); + break; + } + case 5: { + message.statusDetail = reader.string(); + break; + } + case 6: { + message.cancelRequested = reader.bool(); + break; + } + case 7: { + message.apiVersion = reader.string(); + break; + } + case 8: { + message.requestResource = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.stages && message.stages.length)) + message.stages = []; + message.stages.push($root.google.cloud.functions.v2beta.Stage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -31257,6 +33236,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OperationMetadata + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.OperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.OperationMetadata"; + }; + return OperationMetadata; })(); @@ -31409,26 +33403,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.int32(); - break; - case 2: - message.message = reader.string(); - break; - case 3: - message.state = reader.int32(); - break; - case 4: - message.resource = reader.string(); - break; - case 5: - message.resourceUri = reader.string(); - break; - case 6: - if (!(message.stateMessages && message.stateMessages.length)) - message.stateMessages = []; - message.stateMessages.push($root.google.cloud.functions.v2beta.StateMessage.decode(reader, reader.uint32())); - break; + case 1: { + message.name = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.resource = reader.string(); + break; + } + case 5: { + message.resourceUri = reader.string(); + break; + } + case 6: { + if (!(message.stateMessages && message.stateMessages.length)) + message.stateMessages = []; + message.stateMessages.push($root.google.cloud.functions.v2beta.StateMessage.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -31638,6 +33638,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Stage + * @function getTypeUrl + * @memberof google.cloud.functions.v2beta.Stage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Stage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.functions.v2beta.Stage"; + }; + /** * Name enum. * @name google.cloud.functions.v2beta.Stage.Name @@ -31806,14 +33821,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - case 2: - message.fullyDecodeReservedExpansion = reader.bool(); - break; + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -31929,6 +33946,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Http + * @function getTypeUrl + * @memberof google.api.Http + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Http"; + }; + return Http; })(); @@ -32139,38 +34171,48 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.selector = reader.string(); - break; - case 2: - message.get = reader.string(); - break; - case 3: - message.put = reader.string(); - break; - case 4: - message.post = reader.string(); - break; - case 5: - message["delete"] = reader.string(); - break; - case 6: - message.patch = reader.string(); - break; - case 8: - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - case 7: - message.body = reader.string(); - break; - case 12: - message.responseBody = reader.string(); - break; - case 11: - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -32392,6 +34434,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HttpRule + * @function getTypeUrl + * @memberof google.api.HttpRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpRule"; + }; + return HttpRule; })(); @@ -32498,12 +34555,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.kind = reader.string(); - break; - case 2: - message.path = reader.string(); - break; + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -32602,6 +34661,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CustomHttpPattern"; + }; + return CustomHttpPattern; })(); @@ -32796,36 +34870,43 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.pattern && message.pattern.length)) - message.pattern = []; - message.pattern.push(reader.string()); - break; - case 3: - message.nameField = reader.string(); - break; - case 4: - message.history = reader.int32(); - break; - case 5: - message.plural = reader.string(); - break; - case 6: - message.singular = reader.string(); - break; - case 10: - if (!(message.style && message.style.length)) - message.style = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else message.style.push(reader.int32()); - } else - message.style.push(reader.int32()); - break; + break; + } default: reader.skipType(tag & 7); break; @@ -33023,6 +35104,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + /** * History enum. * @name google.api.ResourceDescriptor.History @@ -33159,12 +35255,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - message.childType = reader.string(); - break; + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -33263,6 +35361,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + return ResourceReference; })(); @@ -33372,11 +35485,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.file && message.file.length)) - message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -33483,6 +35597,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + return FileDescriptorSet; })(); @@ -33504,6 +35633,7 @@ * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {string|null} [edition] FileDescriptorProto edition */ /** @@ -33624,6 +35754,14 @@ */ FileDescriptorProto.prototype.syntax = ""; + /** + * FileDescriptorProto edition. + * @member {string} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = ""; + /** * Creates a new FileDescriptorProto instance using the specified properties. * @function create @@ -33679,6 +35817,8 @@ writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); return writer; }; @@ -33713,66 +35853,82 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message["package"] = reader.string(); - break; - case 3: - if (!(message.dependency && message.dependency.length)) - message.dependency = []; - message.dependency.push(reader.string()); - break; - case 10: - if (!(message.publicDependency && message.publicDependency.length)) - message.publicDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else message.publicDependency.push(reader.int32()); - } else - message.publicDependency.push(reader.int32()); - break; - case 11: - if (!(message.weakDependency && message.weakDependency.length)) - message.weakDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else message.weakDependency.push(reader.int32()); - } else - message.weakDependency.push(reader.int32()); - break; - case 4: - if (!(message.messageType && message.messageType.length)) - message.messageType = []; - message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.service && message.service.length)) - message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 8: - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); - break; - case 9: - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); - break; - case 12: - message.syntax = reader.string(); - break; + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 13: { + message.edition = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -33884,6 +36040,9 @@ if (message.syntax != null && message.hasOwnProperty("syntax")) if (!$util.isString(message.syntax)) return "syntax: string expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + if (!$util.isString(message.edition)) + return "edition: string expected"; return null; }; @@ -33976,6 +36135,8 @@ } if (object.syntax != null) message.syntax = String(object.syntax); + if (object.edition != null) + message.edition = String(object.edition); return message; }; @@ -34007,6 +36168,7 @@ object.options = null; object.sourceCodeInfo = null; object.syntax = ""; + object.edition = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -34053,6 +36215,8 @@ } if (message.syntax != null && message.hasOwnProperty("syntax")) object.syntax = message.syntax; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = message.edition; return object; }; @@ -34067,6 +36231,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + return FileDescriptorProto; })(); @@ -34277,52 +36456,62 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.field && message.field.length)) - message.field = []; - message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.nestedType && message.nestedType.length)) - message.nestedType = []; - message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.extensionRange && message.extensionRange.length)) - message.extensionRange = []; - message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.oneofDecl && message.oneofDecl.length)) - message.oneofDecl = []; - message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); - break; - case 7: - message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); - break; - case 9: - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -34623,6 +36812,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + DescriptorProto.ExtensionRange = (function() { /** @@ -34737,15 +36941,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; - case 3: - message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -34857,6 +37064,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + return ExtensionRange; })(); @@ -34963,12 +37185,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -35067,6 +37291,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + return ReservedRange; })(); @@ -35167,11 +37406,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -35278,6 +37518,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + return ExtensionRangeOptions; })(); @@ -35483,39 +37738,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 3: - message.number = reader.int32(); - break; - case 4: - message.label = reader.int32(); - break; - case 5: - message.type = reader.int32(); - break; - case 6: - message.typeName = reader.string(); - break; - case 2: - message.extendee = reader.string(); - break; - case 7: - message.defaultValue = reader.string(); - break; - case 9: - message.oneofIndex = reader.int32(); - break; - case 10: - message.jsonName = reader.string(); - break; - case 8: - message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); - break; - case 17: - message.proto3Optional = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -35802,6 +38068,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + /** * Type enum. * @name google.protobuf.FieldDescriptorProto.Type @@ -35970,12 +38251,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -36079,6 +38362,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + return OneofDescriptorProto; })(); @@ -36224,27 +38522,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.value && message.value.length)) - message.value = []; - message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -36420,6 +38723,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + EnumDescriptorProto.EnumReservedRange = (function() { /** @@ -36523,12 +38841,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -36627,6 +38947,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + return EnumReservedRange; })(); @@ -36747,15 +39082,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.number = reader.int32(); - break; - case 3: - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -36867,6 +39205,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + return EnumValueDescriptorProto; })(); @@ -36986,17 +39339,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.method && message.method.length)) - message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -37126,6 +39482,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + return ServiceDescriptorProto; })(); @@ -37276,24 +39647,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.inputType = reader.string(); - break; - case 3: - message.outputType = reader.string(); - break; - case 4: - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); - break; - case 5: - message.clientStreaming = reader.bool(); - break; - case 6: - message.serverStreaming = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -37429,6 +39806,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + return MethodDescriptorProto; })(); @@ -37759,76 +40151,98 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.javaPackage = reader.string(); - break; - case 8: - message.javaOuterClassname = reader.string(); - break; - case 10: - message.javaMultipleFiles = reader.bool(); - break; - case 20: - message.javaGenerateEqualsAndHash = reader.bool(); - break; - case 27: - message.javaStringCheckUtf8 = reader.bool(); - break; - case 9: - message.optimizeFor = reader.int32(); - break; - case 11: - message.goPackage = reader.string(); - break; - case 16: - message.ccGenericServices = reader.bool(); - break; - case 17: - message.javaGenericServices = reader.bool(); - break; - case 18: - message.pyGenericServices = reader.bool(); - break; - case 42: - message.phpGenericServices = reader.bool(); - break; - case 23: - message.deprecated = reader.bool(); - break; - case 31: - message.ccEnableArenas = reader.bool(); - break; - case 36: - message.objcClassPrefix = reader.string(); - break; - case 37: - message.csharpNamespace = reader.string(); - break; - case 39: - message.swiftPrefix = reader.string(); - break; - case 40: - message.phpClassPrefix = reader.string(); - break; - case 41: - message.phpNamespace = reader.string(); - break; - case 44: - message.phpMetadataNamespace = reader.string(); - break; - case 45: - message.rubyPackage = reader.string(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1053: - if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) - message[".google.api.resourceDefinition"] = []; - message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); - break; + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 42: { + message.phpGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -38141,6 +40555,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; + /** * OptimizeMode enum. * @name google.protobuf.FileOptions.OptimizeMode @@ -38309,26 +40738,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.messageSetWireFormat = reader.bool(); - break; - case 2: - message.noStandardDescriptorAccessor = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 7: - message.mapEntry = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1053: - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); - break; + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -38482,6 +40917,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + return MessageOptions; })(); @@ -38495,6 +40945,7 @@ * @property {boolean|null} [packed] FieldOptions packed * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy * @property {boolean|null} [deprecated] FieldOptions deprecated * @property {boolean|null} [weak] FieldOptions weak * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption @@ -38551,6 +41002,14 @@ */ FieldOptions.prototype.lazy = false; + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + /** * FieldOptions deprecated. * @member {boolean} deprecated @@ -38627,6 +41086,8 @@ writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -38672,42 +41133,55 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ctype = reader.int32(); - break; - case 2: - message.packed = reader.bool(); - break; - case 6: - message.jstype = reader.int32(); - break; - case 5: - message.lazy = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 10: - message.weak = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1052: - if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) - message[".google.api.fieldBehavior"] = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 15: { + message.unverifiedLazy = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 10: { + message.weak = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1052: { + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else message[".google.api.fieldBehavior"].push(reader.int32()); - } else - message[".google.api.fieldBehavior"].push(reader.int32()); - break; - case 1055: - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); - break; + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -38767,6 +41241,9 @@ if (message.lazy != null && message.hasOwnProperty("lazy")) if (typeof message.lazy !== "boolean") return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; if (message.deprecated != null && message.hasOwnProperty("deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; @@ -38852,6 +41329,8 @@ } if (object.lazy != null) message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); if (object.weak != null) @@ -38939,6 +41418,7 @@ object.lazy = false; object.jstype = options.enums === String ? "JS_NORMAL" : 0; object.weak = false; + object.unverifiedLazy = false; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -38953,6 +41433,8 @@ object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; if (message.weak != null && message.hasOwnProperty("weak")) object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -38979,6 +41461,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FieldOptions + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions"; + }; + /** * CType enum. * @name google.protobuf.FieldOptions.CType @@ -39108,11 +41605,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -39219,6 +41717,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + return OneofOptions; })(); @@ -39338,17 +41851,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.allowAlias = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -39473,6 +41989,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumOptions"; + }; + return EnumOptions; })(); @@ -39581,14 +42112,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 1: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -39704,6 +42237,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumValueOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + }; + return EnumValueOptions; })(); @@ -39834,20 +42382,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 33: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1049: - message[".google.api.defaultHost"] = reader.string(); - break; - case 1050: - message[".google.api.oauthScopes"] = reader.string(); - break; + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -39980,6 +42532,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceOptions + * @function getTypeUrl + * @memberof google.protobuf.ServiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; + }; + return ServiceOptions; })(); @@ -40134,28 +42701,34 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 33: - message.deprecated = reader.bool(); - break; - case 34: - message.idempotencyLevel = reader.int32(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 72295728: - message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); - break; - case 1051: - if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) - message[".google.api.methodSignature"] = []; - message[".google.api.methodSignature"].push(reader.string()); - break; - case 1049: - message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); - break; + case 33: { + message.deprecated = reader.bool(); + break; + } + case 34: { + message.idempotencyLevel = reader.int32(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 72295728: { + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + } + case 1051: { + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + } + case 1049: { + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -40345,6 +42918,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MethodOptions + * @function getTypeUrl + * @memberof google.protobuf.MethodOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodOptions"; + }; + /** * IdempotencyLevel enum. * @name google.protobuf.MethodOptions.IdempotencyLevel @@ -40524,29 +43112,36 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.name && message.name.length)) - message.name = []; - message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); - break; - case 3: - message.identifierValue = reader.string(); - break; - case 4: - message.positiveIntValue = reader.uint64(); - break; - case 5: - message.negativeIntValue = reader.int64(); - break; - case 6: - message.doubleValue = reader.double(); - break; - case 7: - message.stringValue = reader.bytes(); - break; - case 8: - message.aggregateValue = reader.string(); - break; + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + } + case 3: { + message.identifierValue = reader.string(); + break; + } + case 4: { + message.positiveIntValue = reader.uint64(); + break; + } + case 5: { + message.negativeIntValue = reader.int64(); + break; + } + case 6: { + message.doubleValue = reader.double(); + break; + } + case 7: { + message.stringValue = reader.bytes(); + break; + } + case 8: { + message.aggregateValue = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -40659,7 +43254,7 @@ if (object.stringValue != null) if (typeof object.stringValue === "string") $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); - else if (object.stringValue.length) + else if (object.stringValue.length >= 0) message.stringValue = object.stringValue; if (object.aggregateValue != null) message.aggregateValue = String(object.aggregateValue); @@ -40740,6 +43335,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UninterpretedOption + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + }; + UninterpretedOption.NamePart = (function() { /** @@ -40841,12 +43451,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.namePart = reader.string(); - break; - case 2: - message.isExtension = reader.bool(); - break; + case 1: { + message.namePart = reader.string(); + break; + } + case 2: { + message.isExtension = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -40947,6 +43559,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NamePart + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; + }; + return NamePart; })(); @@ -41047,11 +43674,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.location && message.location.length)) - message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -41158,6 +43786,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SourceCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; + }; + SourceCodeInfo.Location = (function() { /** @@ -41306,37 +43949,42 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - case 2: - if (!(message.span && message.span.length)) - message.span = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else message.span.push(reader.int32()); - } else - message.span.push(reader.int32()); - break; - case 3: - message.leadingComments = reader.string(); - break; - case 4: - message.trailingComments = reader.string(); - break; - case 6: - if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) - message.leadingDetachedComments = []; - message.leadingDetachedComments.push(reader.string()); - break; + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -41497,6 +44145,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Location + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; + }; + return Location; })(); @@ -41597,11 +44260,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.annotation && message.annotation.length)) - message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -41708,6 +44372,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GeneratedCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; + }; + GeneratedCodeInfo.Annotation = (function() { /** @@ -41718,6 +44397,7 @@ * @property {string|null} [sourceFile] Annotation sourceFile * @property {number|null} [begin] Annotation begin * @property {number|null} [end] Annotation end + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic */ /** @@ -41768,6 +44448,14 @@ */ Annotation.prototype.end = 0; + /** + * Annotation semantic. + * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.semantic = 0; + /** * Creates a new Annotation instance using the specified properties. * @function create @@ -41804,6 +44492,8 @@ writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); return writer; }; @@ -41838,25 +44528,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - case 2: - message.sourceFile = reader.string(); - break; - case 3: - message.begin = reader.int32(); - break; - case 4: - message.end = reader.int32(); - break; + break; + } + case 2: { + message.sourceFile = reader.string(); + break; + } + case 3: { + message.begin = reader.int32(); + break; + } + case 4: { + message.end = reader.int32(); + break; + } + case 5: { + message.semantic = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -41908,6 +44606,15 @@ if (message.end != null && message.hasOwnProperty("end")) if (!$util.isInteger(message.end)) return "end: integer expected"; + if (message.semantic != null && message.hasOwnProperty("semantic")) + switch (message.semantic) { + default: + return "semantic: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -41936,6 +44643,20 @@ message.begin = object.begin | 0; if (object.end != null) message.end = object.end | 0; + switch (object.semantic) { + case "NONE": + case 0: + message.semantic = 0; + break; + case "SET": + case 1: + message.semantic = 1; + break; + case "ALIAS": + case 2: + message.semantic = 2; + break; + } return message; }; @@ -41958,6 +44679,7 @@ object.sourceFile = ""; object.begin = 0; object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; } if (message.path && message.path.length) { object.path = []; @@ -41970,6 +44692,8 @@ object.begin = message.begin; if (message.end != null && message.hasOwnProperty("end")) object.end = message.end; + if (message.semantic != null && message.hasOwnProperty("semantic")) + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; return object; }; @@ -41984,12 +44708,262 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Annotation + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; + }; + + /** + * Semantic enum. + * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} SET=1 SET value + * @property {number} ALIAS=2 ALIAS value + */ + Annotation.Semantic = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "SET"] = 1; + values[valuesById[2] = "ALIAS"] = 2; + return values; + })(); + return Annotation; })(); return GeneratedCodeInfo; })(); + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldMask + * @function getTypeUrl + * @memberof google.protobuf.FieldMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldMask"; + }; + + return FieldMask; + })(); + protobuf.Any = (function() { /** @@ -42093,12 +45067,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type_url = reader.string(); - break; - case 2: - message.value = reader.bytes(); - break; + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -42160,7 +45136,7 @@ if (object.value != null) if (typeof object.value === "string") $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) + else if (object.value.length >= 0) message.value = object.value; return message; }; @@ -42206,6 +45182,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Any + * @function getTypeUrl + * @memberof google.protobuf.Any + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Any"; + }; + return Any; })(); @@ -42312,12 +45303,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); - break; + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -42430,6 +45423,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Duration + * @function getTypeUrl + * @memberof google.protobuf.Duration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Duration"; + }; + return Duration; })(); @@ -42590,210 +45598,22 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Empty; - })(); - - protobuf.FieldMask = (function() { - - /** - * Properties of a FieldMask. - * @memberof google.protobuf - * @interface IFieldMask - * @property {Array.|null} [paths] FieldMask paths - */ - - /** - * Constructs a new FieldMask. - * @memberof google.protobuf - * @classdesc Represents a FieldMask. - * @implements IFieldMask - * @constructor - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - */ - function FieldMask(properties) { - this.paths = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FieldMask paths. - * @member {Array.} paths - * @memberof google.protobuf.FieldMask - * @instance - */ - FieldMask.prototype.paths = $util.emptyArray; - - /** - * Creates a new FieldMask instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - * @returns {google.protobuf.FieldMask} FieldMask instance - */ - FieldMask.create = function create(properties) { - return new FieldMask(properties); - }; - /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldMask.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.paths != null && message.paths.length) - for (var i = 0; i < message.paths.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); - return writer; - }; - - /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldMask.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldMask message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldMask - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldMask} FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldMask.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldMask - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldMask} FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldMask.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldMask message. - * @function verify - * @memberof google.protobuf.FieldMask - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldMask.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.paths != null && message.hasOwnProperty("paths")) { - if (!Array.isArray(message.paths)) - return "paths: array expected"; - for (var i = 0; i < message.paths.length; ++i) - if (!$util.isString(message.paths[i])) - return "paths: string[] expected"; - } - return null; - }; - - /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldMask - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldMask} FieldMask - */ - FieldMask.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldMask) - return object; - var message = new $root.google.protobuf.FieldMask(); - if (object.paths) { - if (!Array.isArray(object.paths)) - throw TypeError(".google.protobuf.FieldMask.paths: array expected"); - message.paths = []; - for (var i = 0; i < object.paths.length; ++i) - message.paths[i] = String(object.paths[i]); - } - return message; - }; - - /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldMask + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.FieldMask} message FieldMask - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url */ - FieldMask.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.paths = []; - if (message.paths && message.paths.length) { - object.paths = []; - for (var j = 0; j < message.paths.length; ++j) - object.paths[j] = message.paths[j]; + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - return object; - }; - - /** - * Converts this FieldMask to JSON. - * @function toJSON - * @memberof google.protobuf.FieldMask - * @instance - * @returns {Object.} JSON object - */ - FieldMask.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + return typeUrlPrefix + "/google.protobuf.Empty"; }; - return FieldMask; + return Empty; })(); protobuf.Timestamp = (function() { @@ -42899,12 +45719,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); - break; + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -43017,6 +45839,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Timestamp + * @function getTypeUrl + * @memberof google.protobuf.Timestamp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Timestamp"; + }; + return Timestamp; })(); @@ -43074,7 +45911,7 @@ }; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|setIamPolicy}. * @memberof google.iam.v1.IAMPolicy * @typedef SetIamPolicyCallback * @type {function} @@ -43107,7 +45944,7 @@ */ /** - * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|getIamPolicy}. * @memberof google.iam.v1.IAMPolicy * @typedef GetIamPolicyCallback * @type {function} @@ -43140,7 +45977,7 @@ */ /** - * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * Callback as used by {@link google.iam.v1.IAMPolicy|testIamPermissions}. * @memberof google.iam.v1.IAMPolicy * @typedef TestIamPermissionsCallback * @type {function} @@ -43183,6 +46020,7 @@ * @interface ISetIamPolicyRequest * @property {string|null} [resource] SetIamPolicyRequest resource * @property {google.iam.v1.IPolicy|null} [policy] SetIamPolicyRequest policy + * @property {google.protobuf.IFieldMask|null} [updateMask] SetIamPolicyRequest updateMask */ /** @@ -43216,6 +46054,14 @@ */ SetIamPolicyRequest.prototype.policy = null; + /** + * SetIamPolicyRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + */ + SetIamPolicyRequest.prototype.updateMask = null; + /** * Creates a new SetIamPolicyRequest instance using the specified properties. * @function create @@ -43244,6 +46090,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); if (message.policy != null && Object.hasOwnProperty.call(message, "policy")) $root.google.iam.v1.Policy.encode(message.policy, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -43278,12 +46126,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resource = reader.string(); - break; - case 2: - message.policy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); - break; + case 1: { + message.resource = reader.string(); + break; + } + case 2: { + message.policy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -43327,6 +46181,11 @@ if (error) return "policy." + error; } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } return null; }; @@ -43349,6 +46208,11 @@ throw TypeError(".google.iam.v1.SetIamPolicyRequest.policy: object expected"); message.policy = $root.google.iam.v1.Policy.fromObject(object.policy); } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.iam.v1.SetIamPolicyRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } return message; }; @@ -43368,11 +46232,14 @@ if (options.defaults) { object.resource = ""; object.policy = null; + object.updateMask = null; } if (message.resource != null && message.hasOwnProperty("resource")) object.resource = message.resource; if (message.policy != null && message.hasOwnProperty("policy")) object.policy = $root.google.iam.v1.Policy.toObject(message.policy, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; @@ -43387,6 +46254,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetIamPolicyRequest + * @function getTypeUrl + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetIamPolicyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.SetIamPolicyRequest"; + }; + return SetIamPolicyRequest; })(); @@ -43493,12 +46375,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resource = reader.string(); - break; - case 2: - message.options = $root.google.iam.v1.GetPolicyOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.resource = reader.string(); + break; + } + case 2: { + message.options = $root.google.iam.v1.GetPolicyOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -43602,6 +46486,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetIamPolicyRequest + * @function getTypeUrl + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetIamPolicyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.GetIamPolicyRequest"; + }; + return GetIamPolicyRequest; })(); @@ -43710,14 +46609,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resource = reader.string(); - break; - case 2: - if (!(message.permissions && message.permissions.length)) - message.permissions = []; - message.permissions.push(reader.string()); - break; + case 1: { + message.resource = reader.string(); + break; + } + case 2: { + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -43828,6 +46729,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TestIamPermissionsRequest + * @function getTypeUrl + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TestIamPermissionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.TestIamPermissionsRequest"; + }; + return TestIamPermissionsRequest; })(); @@ -43925,11 +46841,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.permissions && message.permissions.length)) - message.permissions = []; - message.permissions.push(reader.string()); - break; + case 1: { + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -44031,6 +46948,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TestIamPermissionsResponse + * @function getTypeUrl + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TestIamPermissionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.TestIamPermissionsResponse"; + }; + return TestIamPermissionsResponse; })(); @@ -44126,9 +47058,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.requestedPolicyVersion = reader.int32(); - break; + case 1: { + message.requestedPolicyVersion = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -44218,6 +47151,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetPolicyOptions + * @function getTypeUrl + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetPolicyOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.GetPolicyOptions"; + }; + return GetPolicyOptions; })(); @@ -44229,6 +47177,7 @@ * @interface IPolicy * @property {number|null} [version] Policy version * @property {Array.|null} [bindings] Policy bindings + * @property {Array.|null} [auditConfigs] Policy auditConfigs * @property {Uint8Array|null} [etag] Policy etag */ @@ -44242,6 +47191,7 @@ */ function Policy(properties) { this.bindings = []; + this.auditConfigs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44264,6 +47214,14 @@ */ Policy.prototype.bindings = $util.emptyArray; + /** + * Policy auditConfigs. + * @member {Array.} auditConfigs + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.auditConfigs = $util.emptyArray; + /** * Policy etag. * @member {Uint8Array} etag @@ -44303,6 +47261,9 @@ if (message.bindings != null && message.bindings.length) for (var i = 0; i < message.bindings.length; ++i) $root.google.iam.v1.Binding.encode(message.bindings[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.auditConfigs != null && message.auditConfigs.length) + for (var i = 0; i < message.auditConfigs.length; ++i) + $root.google.iam.v1.AuditConfig.encode(message.auditConfigs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -44337,17 +47298,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.version = reader.int32(); - break; - case 4: - if (!(message.bindings && message.bindings.length)) - message.bindings = []; - message.bindings.push($root.google.iam.v1.Binding.decode(reader, reader.uint32())); - break; - case 3: - message.etag = reader.bytes(); - break; + case 1: { + message.version = reader.int32(); + break; + } + case 4: { + if (!(message.bindings && message.bindings.length)) + message.bindings = []; + message.bindings.push($root.google.iam.v1.Binding.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.auditConfigs && message.auditConfigs.length)) + message.auditConfigs = []; + message.auditConfigs.push($root.google.iam.v1.AuditConfig.decode(reader, reader.uint32())); + break; + } + case 3: { + message.etag = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -44395,6 +47365,15 @@ return "bindings." + error; } } + if (message.auditConfigs != null && message.hasOwnProperty("auditConfigs")) { + if (!Array.isArray(message.auditConfigs)) + return "auditConfigs: array expected"; + for (var i = 0; i < message.auditConfigs.length; ++i) { + var error = $root.google.iam.v1.AuditConfig.verify(message.auditConfigs[i]); + if (error) + return "auditConfigs." + error; + } + } if (message.etag != null && message.hasOwnProperty("etag")) if (!(message.etag && typeof message.etag.length === "number" || $util.isString(message.etag))) return "etag: buffer expected"; @@ -44425,10 +47404,20 @@ message.bindings[i] = $root.google.iam.v1.Binding.fromObject(object.bindings[i]); } } + if (object.auditConfigs) { + if (!Array.isArray(object.auditConfigs)) + throw TypeError(".google.iam.v1.Policy.auditConfigs: array expected"); + message.auditConfigs = []; + for (var i = 0; i < object.auditConfigs.length; ++i) { + if (typeof object.auditConfigs[i] !== "object") + throw TypeError(".google.iam.v1.Policy.auditConfigs: object expected"); + message.auditConfigs[i] = $root.google.iam.v1.AuditConfig.fromObject(object.auditConfigs[i]); + } + } if (object.etag != null) if (typeof object.etag === "string") $util.base64.decode(object.etag, message.etag = $util.newBuffer($util.base64.length(object.etag)), 0); - else if (object.etag.length) + else if (object.etag.length >= 0) message.etag = object.etag; return message; }; @@ -44446,8 +47435,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.bindings = []; + object.auditConfigs = []; + } if (options.defaults) { object.version = 0; if (options.bytes === String) @@ -44467,6 +47458,11 @@ for (var j = 0; j < message.bindings.length; ++j) object.bindings[j] = $root.google.iam.v1.Binding.toObject(message.bindings[j], options); } + if (message.auditConfigs && message.auditConfigs.length) { + object.auditConfigs = []; + for (var j = 0; j < message.auditConfigs.length; ++j) + object.auditConfigs[j] = $root.google.iam.v1.AuditConfig.toObject(message.auditConfigs[j], options); + } return object; }; @@ -44481,6 +47477,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Policy + * @function getTypeUrl + * @memberof google.iam.v1.Policy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Policy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.Policy"; + }; + return Policy; })(); @@ -44600,17 +47611,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.role = reader.string(); - break; - case 2: - if (!(message.members && message.members.length)) - message.members = []; - message.members.push(reader.string()); - break; - case 3: - message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); - break; + case 1: { + message.role = reader.string(); + break; + } + case 2: { + if (!(message.members && message.members.length)) + message.members = []; + message.members.push(reader.string()); + break; + } + case 3: { + message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -44735,9 +47749,556 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Binding + * @function getTypeUrl + * @memberof google.iam.v1.Binding + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Binding.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.Binding"; + }; + return Binding; })(); + v1.AuditConfig = (function() { + + /** + * Properties of an AuditConfig. + * @memberof google.iam.v1 + * @interface IAuditConfig + * @property {string|null} [service] AuditConfig service + * @property {Array.|null} [auditLogConfigs] AuditConfig auditLogConfigs + */ + + /** + * Constructs a new AuditConfig. + * @memberof google.iam.v1 + * @classdesc Represents an AuditConfig. + * @implements IAuditConfig + * @constructor + * @param {google.iam.v1.IAuditConfig=} [properties] Properties to set + */ + function AuditConfig(properties) { + this.auditLogConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AuditConfig service. + * @member {string} service + * @memberof google.iam.v1.AuditConfig + * @instance + */ + AuditConfig.prototype.service = ""; + + /** + * AuditConfig auditLogConfigs. + * @member {Array.} auditLogConfigs + * @memberof google.iam.v1.AuditConfig + * @instance + */ + AuditConfig.prototype.auditLogConfigs = $util.emptyArray; + + /** + * Creates a new AuditConfig instance using the specified properties. + * @function create + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.IAuditConfig=} [properties] Properties to set + * @returns {google.iam.v1.AuditConfig} AuditConfig instance + */ + AuditConfig.create = function create(properties) { + return new AuditConfig(properties); + }; + + /** + * Encodes the specified AuditConfig message. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.IAuditConfig} message AuditConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.service); + if (message.auditLogConfigs != null && message.auditLogConfigs.length) + for (var i = 0; i < message.auditLogConfigs.length; ++i) + $root.google.iam.v1.AuditLogConfig.encode(message.auditLogConfigs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AuditConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.IAuditConfig} message AuditConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AuditConfig message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.AuditConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.AuditConfig} AuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.AuditConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.service = reader.string(); + break; + } + case 3: { + if (!(message.auditLogConfigs && message.auditLogConfigs.length)) + message.auditLogConfigs = []; + message.auditLogConfigs.push($root.google.iam.v1.AuditLogConfig.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AuditConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.AuditConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.AuditConfig} AuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AuditConfig message. + * @function verify + * @memberof google.iam.v1.AuditConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AuditConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.auditLogConfigs != null && message.hasOwnProperty("auditLogConfigs")) { + if (!Array.isArray(message.auditLogConfigs)) + return "auditLogConfigs: array expected"; + for (var i = 0; i < message.auditLogConfigs.length; ++i) { + var error = $root.google.iam.v1.AuditLogConfig.verify(message.auditLogConfigs[i]); + if (error) + return "auditLogConfigs." + error; + } + } + return null; + }; + + /** + * Creates an AuditConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.AuditConfig + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.AuditConfig} AuditConfig + */ + AuditConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.AuditConfig) + return object; + var message = new $root.google.iam.v1.AuditConfig(); + if (object.service != null) + message.service = String(object.service); + if (object.auditLogConfigs) { + if (!Array.isArray(object.auditLogConfigs)) + throw TypeError(".google.iam.v1.AuditConfig.auditLogConfigs: array expected"); + message.auditLogConfigs = []; + for (var i = 0; i < object.auditLogConfigs.length; ++i) { + if (typeof object.auditLogConfigs[i] !== "object") + throw TypeError(".google.iam.v1.AuditConfig.auditLogConfigs: object expected"); + message.auditLogConfigs[i] = $root.google.iam.v1.AuditLogConfig.fromObject(object.auditLogConfigs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an AuditConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.AuditConfig} message AuditConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuditConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.auditLogConfigs = []; + if (options.defaults) + object.service = ""; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.auditLogConfigs && message.auditLogConfigs.length) { + object.auditLogConfigs = []; + for (var j = 0; j < message.auditLogConfigs.length; ++j) + object.auditLogConfigs[j] = $root.google.iam.v1.AuditLogConfig.toObject(message.auditLogConfigs[j], options); + } + return object; + }; + + /** + * Converts this AuditConfig to JSON. + * @function toJSON + * @memberof google.iam.v1.AuditConfig + * @instance + * @returns {Object.} JSON object + */ + AuditConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AuditConfig + * @function getTypeUrl + * @memberof google.iam.v1.AuditConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AuditConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.AuditConfig"; + }; + + return AuditConfig; + })(); + + v1.AuditLogConfig = (function() { + + /** + * Properties of an AuditLogConfig. + * @memberof google.iam.v1 + * @interface IAuditLogConfig + * @property {google.iam.v1.AuditLogConfig.LogType|null} [logType] AuditLogConfig logType + * @property {Array.|null} [exemptedMembers] AuditLogConfig exemptedMembers + */ + + /** + * Constructs a new AuditLogConfig. + * @memberof google.iam.v1 + * @classdesc Represents an AuditLogConfig. + * @implements IAuditLogConfig + * @constructor + * @param {google.iam.v1.IAuditLogConfig=} [properties] Properties to set + */ + function AuditLogConfig(properties) { + this.exemptedMembers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AuditLogConfig logType. + * @member {google.iam.v1.AuditLogConfig.LogType} logType + * @memberof google.iam.v1.AuditLogConfig + * @instance + */ + AuditLogConfig.prototype.logType = 0; + + /** + * AuditLogConfig exemptedMembers. + * @member {Array.} exemptedMembers + * @memberof google.iam.v1.AuditLogConfig + * @instance + */ + AuditLogConfig.prototype.exemptedMembers = $util.emptyArray; + + /** + * Creates a new AuditLogConfig instance using the specified properties. + * @function create + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig=} [properties] Properties to set + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig instance + */ + AuditLogConfig.create = function create(properties) { + return new AuditLogConfig(properties); + }; + + /** + * Encodes the specified AuditLogConfig message. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig} message AuditLogConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditLogConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.logType); + if (message.exemptedMembers != null && message.exemptedMembers.length) + for (var i = 0; i < message.exemptedMembers.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.exemptedMembers[i]); + return writer; + }; + + /** + * Encodes the specified AuditLogConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig} message AuditLogConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditLogConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditLogConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.AuditLogConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.logType = reader.int32(); + break; + } + case 2: { + if (!(message.exemptedMembers && message.exemptedMembers.length)) + message.exemptedMembers = []; + message.exemptedMembers.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditLogConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AuditLogConfig message. + * @function verify + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AuditLogConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logType != null && message.hasOwnProperty("logType")) + switch (message.logType) { + default: + return "logType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.exemptedMembers != null && message.hasOwnProperty("exemptedMembers")) { + if (!Array.isArray(message.exemptedMembers)) + return "exemptedMembers: array expected"; + for (var i = 0; i < message.exemptedMembers.length; ++i) + if (!$util.isString(message.exemptedMembers[i])) + return "exemptedMembers: string[] expected"; + } + return null; + }; + + /** + * Creates an AuditLogConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + */ + AuditLogConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.AuditLogConfig) + return object; + var message = new $root.google.iam.v1.AuditLogConfig(); + switch (object.logType) { + case "LOG_TYPE_UNSPECIFIED": + case 0: + message.logType = 0; + break; + case "ADMIN_READ": + case 1: + message.logType = 1; + break; + case "DATA_WRITE": + case 2: + message.logType = 2; + break; + case "DATA_READ": + case 3: + message.logType = 3; + break; + } + if (object.exemptedMembers) { + if (!Array.isArray(object.exemptedMembers)) + throw TypeError(".google.iam.v1.AuditLogConfig.exemptedMembers: array expected"); + message.exemptedMembers = []; + for (var i = 0; i < object.exemptedMembers.length; ++i) + message.exemptedMembers[i] = String(object.exemptedMembers[i]); + } + return message; + }; + + /** + * Creates a plain object from an AuditLogConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.AuditLogConfig} message AuditLogConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuditLogConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.exemptedMembers = []; + if (options.defaults) + object.logType = options.enums === String ? "LOG_TYPE_UNSPECIFIED" : 0; + if (message.logType != null && message.hasOwnProperty("logType")) + object.logType = options.enums === String ? $root.google.iam.v1.AuditLogConfig.LogType[message.logType] : message.logType; + if (message.exemptedMembers && message.exemptedMembers.length) { + object.exemptedMembers = []; + for (var j = 0; j < message.exemptedMembers.length; ++j) + object.exemptedMembers[j] = message.exemptedMembers[j]; + } + return object; + }; + + /** + * Converts this AuditLogConfig to JSON. + * @function toJSON + * @memberof google.iam.v1.AuditLogConfig + * @instance + * @returns {Object.} JSON object + */ + AuditLogConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AuditLogConfig + * @function getTypeUrl + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AuditLogConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.AuditLogConfig"; + }; + + /** + * LogType enum. + * @name google.iam.v1.AuditLogConfig.LogType + * @enum {number} + * @property {number} LOG_TYPE_UNSPECIFIED=0 LOG_TYPE_UNSPECIFIED value + * @property {number} ADMIN_READ=1 ADMIN_READ value + * @property {number} DATA_WRITE=2 DATA_WRITE value + * @property {number} DATA_READ=3 DATA_READ value + */ + AuditLogConfig.LogType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LOG_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADMIN_READ"] = 1; + values[valuesById[2] = "DATA_WRITE"] = 2; + values[valuesById[3] = "DATA_READ"] = 3; + return values; + })(); + + return AuditLogConfig; + })(); + v1.PolicyDelta = (function() { /** @@ -44845,16 +48406,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.bindingDeltas && message.bindingDeltas.length)) - message.bindingDeltas = []; - message.bindingDeltas.push($root.google.iam.v1.BindingDelta.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.auditConfigDeltas && message.auditConfigDeltas.length)) - message.auditConfigDeltas = []; - message.auditConfigDeltas.push($root.google.iam.v1.AuditConfigDelta.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.bindingDeltas && message.bindingDeltas.length)) + message.bindingDeltas = []; + message.bindingDeltas.push($root.google.iam.v1.BindingDelta.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.auditConfigDeltas && message.auditConfigDeltas.length)) + message.auditConfigDeltas = []; + message.auditConfigDeltas.push($root.google.iam.v1.AuditConfigDelta.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -44987,6 +48550,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PolicyDelta + * @function getTypeUrl + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PolicyDelta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.PolicyDelta"; + }; + return PolicyDelta; })(); @@ -45115,18 +48693,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.action = reader.int32(); - break; - case 2: - message.role = reader.string(); - break; - case 3: - message.member = reader.string(); - break; - case 4: - message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); - break; + case 1: { + message.action = reader.int32(); + break; + } + case 2: { + message.role = reader.string(); + break; + } + case 3: { + message.member = reader.string(); + break; + } + case 4: { + message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -45264,6 +48846,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BindingDelta + * @function getTypeUrl + * @memberof google.iam.v1.BindingDelta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BindingDelta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.BindingDelta"; + }; + /** * Action enum. * @name google.iam.v1.BindingDelta.Action @@ -45408,18 +49005,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.action = reader.int32(); - break; - case 2: - message.service = reader.string(); - break; - case 3: - message.exemptedMember = reader.string(); - break; - case 4: - message.logType = reader.string(); - break; + case 1: { + message.action = reader.int32(); + break; + } + case 2: { + message.service = reader.string(); + break; + } + case 3: { + message.exemptedMember = reader.string(); + break; + } + case 4: { + message.logType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -45552,6 +49153,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AuditConfigDelta + * @function getTypeUrl + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AuditConfigDelta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.AuditConfigDelta"; + }; + /** * Action enum. * @name google.iam.v1.AuditConfigDelta.Action @@ -45711,18 +49327,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.expression = reader.string(); - break; - case 2: - message.title = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.location = reader.string(); - break; + case 1: { + message.expression = reader.string(); + break; + } + case 2: { + message.title = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.location = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -45837,6 +49457,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Expr + * @function getTypeUrl + * @memberof google.type.Expr + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Expr.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Expr"; + }; + return Expr; })(); @@ -45885,7 +49520,7 @@ }; /** - * Callback as used by {@link google.longrunning.Operations#listOperations}. + * Callback as used by {@link google.longrunning.Operations|listOperations}. * @memberof google.longrunning.Operations * @typedef ListOperationsCallback * @type {function} @@ -45918,7 +49553,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#getOperation}. + * Callback as used by {@link google.longrunning.Operations|getOperation}. * @memberof google.longrunning.Operations * @typedef GetOperationCallback * @type {function} @@ -45951,7 +49586,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#deleteOperation}. + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. * @memberof google.longrunning.Operations * @typedef DeleteOperationCallback * @type {function} @@ -45984,7 +49619,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#cancelOperation}. + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. * @memberof google.longrunning.Operations * @typedef CancelOperationCallback * @type {function} @@ -46017,7 +49652,7 @@ */ /** - * Callback as used by {@link google.longrunning.Operations#waitOperation}. + * Callback as used by {@link google.longrunning.Operations|waitOperation}. * @memberof google.longrunning.Operations * @typedef WaitOperationCallback * @type {function} @@ -46202,21 +49837,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.done = reader.bool(); - break; - case 4: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 5: - message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 3: { + message.done = reader.bool(); + break; + } + case 4: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 5: { + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -46367,6 +50007,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Operation + * @function getTypeUrl + * @memberof google.longrunning.Operation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.Operation"; + }; + return Operation; })(); @@ -46462,9 +50117,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -46554,6 +50210,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.GetOperationRequest"; + }; + return GetOperationRequest; })(); @@ -46682,18 +50353,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.name = reader.string(); - break; - case 1: - message.filter = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 4: { + message.name = reader.string(); + break; + } + case 1: { + message.filter = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -46808,6 +50483,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListOperationsRequest + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsRequest"; + }; + return ListOperationsRequest; })(); @@ -46916,14 +50606,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.operations && message.operations.length)) - message.operations = []; - message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.operations && message.operations.length)) + message.operations = []; + message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -47039,6 +50731,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListOperationsResponse + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsResponse"; + }; + return ListOperationsResponse; })(); @@ -47134,9 +50841,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -47226,6 +50934,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CancelOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CancelOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.CancelOperationRequest"; + }; + return CancelOperationRequest; })(); @@ -47321,9 +51044,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -47413,6 +51137,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DeleteOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.DeleteOperationRequest"; + }; + return DeleteOperationRequest; })(); @@ -47519,12 +51258,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -47628,6 +51369,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for WaitOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WaitOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.WaitOperationRequest"; + }; + return WaitOperationRequest; })(); @@ -47734,12 +51490,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.responseType = reader.string(); - break; - case 2: - message.metadataType = reader.string(); - break; + case 1: { + message.responseType = reader.string(); + break; + } + case 2: { + message.metadataType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -47838,6 +51596,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OperationInfo + * @function getTypeUrl + * @memberof google.longrunning.OperationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.OperationInfo"; + }; + return OperationInfo; })(); @@ -47969,17 +51742,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.code = reader.int32(); - break; - case 2: - message.message = reader.string(); - break; - case 3: - if (!(message.details && message.details.length)) - message.details = []; - message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -48104,6 +51880,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Status + * @function getTypeUrl + * @memberof google.rpc.Status + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.rpc.Status"; + }; + return Status; })(); diff --git a/packages/google-cloud-functions/protos/protos.json b/packages/google-cloud-functions/protos/protos.json index 31d343a0d5c..96b51701a70 100644 --- a/packages/google-cloud-functions/protos/protos.json +++ b/packages/google-cloud-functions/protos/protos.json @@ -4059,6 +4059,10 @@ "syntax": { "type": "string", "id": 12 + }, + "edition": { + "type": "string", + "id": 13 } } }, @@ -4587,6 +4591,13 @@ "default": false } }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, "deprecated": { "type": "bool", "id": 3, @@ -4879,11 +4890,33 @@ "end": { "type": "int32", "id": 4 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } } } } } }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, "Any": { "fields": { "type_url": { @@ -4911,15 +4944,6 @@ "Empty": { "fields": {} }, - "FieldMask": { - "fields": { - "paths": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - }, "Timestamp": { "fields": { "seconds": { @@ -5018,6 +5042,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 } } }, @@ -5085,6 +5113,11 @@ "type": "Binding", "id": 4 }, + "auditConfigs": { + "rule": "repeated", + "type": "AuditConfig", + "id": 6 + }, "etag": { "type": "bytes", "id": 3 @@ -5108,6 +5141,42 @@ } } }, + "AuditConfig": { + "fields": { + "service": { + "type": "string", + "id": 1 + }, + "auditLogConfigs": { + "rule": "repeated", + "type": "AuditLogConfig", + "id": 3 + } + } + }, + "AuditLogConfig": { + "fields": { + "logType": { + "type": "LogType", + "id": 1 + }, + "exemptedMembers": { + "rule": "repeated", + "type": "string", + "id": 2 + } + }, + "nested": { + "LogType": { + "values": { + "LOG_TYPE_UNSPECIFIED": 0, + "ADMIN_READ": 1, + "DATA_WRITE": 2, + "DATA_READ": 3 + } + } + } + }, "PolicyDelta": { "fields": { "bindingDeltas": { From 8a9095e3395db5b4c152f4b5b125ae01d512b13a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 27 Aug 2022 05:02:12 +0000 Subject: [PATCH 114/123] fix: do not import the whole google-gax from proto JS (#1553) (#185) fix: use google-gax v3.3.0 Source-Link: https://github.com/googleapis/synthtool/commit/c73d112a11a1f1a93efa67c50495c19aa3a88910 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:b15a6f06cc06dcffa11e1bebdf1a74b6775a134aac24a0f86f51ddf728eb373e --- packages/google-cloud-functions/package.json | 2 +- packages/google-cloud-functions/protos/protos.d.ts | 2 +- packages/google-cloud-functions/protos/protos.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 0ff618001bc..70519416741 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,7 +39,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^3.0.1" + "google-gax": "^3.3.0" }, "devDependencies": { "@types/mocha": "^9.0.0", diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index 6a3da1e7126..a52644d7e7b 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import Long = require("long"); -import {protobuf as $protobuf} from "google-gax"; +import type {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 311dc5061e0..07fb29cfa1e 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -19,7 +19,7 @@ define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("google-gax").protobufMinimal); + module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); })(this, function($protobuf) { "use strict"; From 9ebb2fd6433ebcc7a5de7ed7c0a8fc035faca6b1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 20:56:19 +0000 Subject: [PATCH 115/123] fix: allow passing gax instance to client constructor (#186) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 470911839 Source-Link: https://github.com/googleapis/googleapis/commit/352756699ebc5b2144c252867c265ea44448712e Source-Link: https://github.com/googleapis/googleapis-gen/commit/f16a1d224f00a630ea43d6a9a1a31f566f45cdea Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjE2YTFkMjI0ZjAwYTYzMGVhNDNkNmE5YTFhMzFmNTY2ZjQ1Y2RlYSJ9 feat: accept google-gax instance as a parameter Please see the documentation of the client constructor for details. PiperOrigin-RevId: 470332808 Source-Link: https://github.com/googleapis/googleapis/commit/d4a23675457cd8f0b44080e0594ec72de1291b89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e97a1ac204ead4fe7341f91e72db7c6ac6016341 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTk3YTFhYzIwNGVhZDRmZTczNDFmOTFlNzJkYjdjNmFjNjAxNjM0MSJ9 --- .../src/v1/cloud_functions_service_client.ts | 80 +++++++++++------- .../src/v2/function_service_client.ts | 83 ++++++++++++------- .../src/v2alpha/function_service_client.ts | 83 ++++++++++++------- .../src/v2beta/function_service_client.ts | 83 ++++++++++++------- 4 files changed, 201 insertions(+), 128 deletions(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 3b19399a922..69bdb0207cd 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -28,7 +28,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -38,7 +37,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './cloud_functions_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -99,8 +97,18 @@ export class CloudFunctionsServiceClient { * 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 CloudFunctionsServiceClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof CloudFunctionsServiceClient; @@ -121,8 +129,13 @@ export class CloudFunctionsServiceClient { 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 ? gax.fallback : 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); @@ -270,7 +283,7 @@ export class CloudFunctionsServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -482,7 +495,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -572,7 +585,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -706,7 +719,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -805,7 +818,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -901,7 +914,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ resource: request.resource || '', }); this.initialize(); @@ -990,7 +1003,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ resource: request.resource || '', }); this.initialize(); @@ -1082,7 +1095,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ resource: request.resource || '', }); this.initialize(); @@ -1191,7 +1204,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ location: request.location || '', }); this.initialize(); @@ -1217,11 +1230,12 @@ export class CloudFunctionsServiceClient { protos.google.cloud.functions.v1.OperationMetadataV1 > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1330,7 +1344,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'function.name': request.function!.name || '', }); this.initialize(); @@ -1356,11 +1370,12 @@ export class CloudFunctionsServiceClient { protos.google.cloud.functions.v1.OperationMetadataV1 > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1469,7 +1484,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1495,11 +1510,12 @@ export class CloudFunctionsServiceClient { protos.google.cloud.functions.v1.OperationMetadataV1 > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1609,7 +1625,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1655,7 +1671,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listFunctions']; @@ -1710,7 +1726,7 @@ export class CloudFunctionsServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listFunctions']; diff --git a/packages/google-cloud-functions/src/v2/function_service_client.ts b/packages/google-cloud-functions/src/v2/function_service_client.ts index 1a39233ccc3..b0ee96abfb2 100644 --- a/packages/google-cloud-functions/src/v2/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2/function_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -32,7 +32,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -42,7 +41,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './function_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -110,8 +108,18 @@ export class FunctionServiceClient { * 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}. - */ - constructor(opts?: ClientOptions) { + * @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 FunctionServiceClient({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 FunctionServiceClient; const servicePath = @@ -131,8 +139,13 @@ export class FunctionServiceClient { 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 ? gax.fallback : 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); @@ -153,9 +166,12 @@ export class FunctionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.iamClient = new IamClient(this._gaxGrpc, opts); + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - this.locationsClient = new LocationsClient(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}`]; @@ -318,7 +334,7 @@ export class FunctionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -527,7 +543,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -641,7 +657,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -737,7 +753,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -826,7 +842,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -941,7 +957,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -967,11 +983,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1082,7 +1099,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'function.name': request.function!.name || '', }); this.initialize(); @@ -1108,11 +1125,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1221,7 +1239,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1247,11 +1265,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1368,7 +1387,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1421,7 +1440,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listFunctions']; @@ -1483,7 +1502,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listFunctions']; diff --git a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts index 0d61b8b29d1..df1b3ff757b 100644 --- a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -32,7 +32,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -42,7 +41,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './function_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -110,8 +108,18 @@ export class FunctionServiceClient { * 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}. - */ - constructor(opts?: ClientOptions) { + * @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 FunctionServiceClient({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 FunctionServiceClient; const servicePath = @@ -131,8 +139,13 @@ export class FunctionServiceClient { 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 ? gax.fallback : 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); @@ -153,9 +166,12 @@ export class FunctionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.iamClient = new IamClient(this._gaxGrpc, opts); + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - this.locationsClient = new LocationsClient(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}`]; @@ -318,7 +334,7 @@ export class FunctionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -533,7 +549,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -653,7 +669,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -755,7 +771,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -850,7 +866,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -965,7 +981,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -991,11 +1007,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2alpha.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1106,7 +1123,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'function.name': request.function!.name || '', }); this.initialize(); @@ -1132,11 +1149,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2alpha.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1245,7 +1263,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1271,11 +1289,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2alpha.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1392,7 +1411,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1445,7 +1464,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listFunctions']; @@ -1507,7 +1526,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listFunctions']; diff --git a/packages/google-cloud-functions/src/v2beta/function_service_client.ts b/packages/google-cloud-functions/src/v2beta/function_service_client.ts index 0e61895b46a..8dc52a9b4b1 100644 --- a/packages/google-cloud-functions/src/v2beta/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2beta/function_service_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -32,7 +32,6 @@ import { LocationsClient, LocationProtos, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -42,7 +41,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './function_service_client_config.json'; -import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; /** @@ -110,8 +108,18 @@ export class FunctionServiceClient { * 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}. - */ - constructor(opts?: ClientOptions) { + * @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 FunctionServiceClient({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 FunctionServiceClient; const servicePath = @@ -131,8 +139,13 @@ export class FunctionServiceClient { 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 ? gax.fallback : 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); @@ -153,9 +166,12 @@ export class FunctionServiceClient { if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } - this.iamClient = new IamClient(this._gaxGrpc, opts); + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - this.locationsClient = new LocationsClient(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}`]; @@ -318,7 +334,7 @@ export class FunctionServiceClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -533,7 +549,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -653,7 +669,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -755,7 +771,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -850,7 +866,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -965,7 +981,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -991,11 +1007,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2beta.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1106,7 +1123,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ 'function.name': request.function!.name || '', }); this.initialize(); @@ -1132,11 +1149,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2beta.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.updateFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1245,7 +1263,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1271,11 +1289,12 @@ export class FunctionServiceClient { protos.google.cloud.functions.v2beta.OperationMetadata > > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( + const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.deleteFunction, this._gaxModule.createDefaultBackoffSettings() @@ -1392,7 +1411,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -1445,7 +1464,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listFunctions']; @@ -1507,7 +1526,7 @@ export class FunctionServiceClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listFunctions']; From 7fa960f3590c27f10e3b2bdef4f6ae4f2907e90f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 8 Sep 2022 16:40:53 -0400 Subject: [PATCH 116/123] chore(main): release 2.2.1 (#183) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 2.2.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-functions/CHANGELOG.md | 11 +++++++++++ packages/google-cloud-functions/package.json | 2 +- .../snippet_metadata.google.cloud.functions.v1.json | 2 +- .../snippet_metadata.google.cloud.functions.v2.json | 2 +- ...ippet_metadata.google.cloud.functions.v2alpha.json | 2 +- ...nippet_metadata.google.cloud.functions.v2beta.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index a993c72fb29..57dd7d4df44 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [2.2.1](https://github.com/googleapis/nodejs-functions/compare/v2.2.0...v2.2.1) (2022-09-01) + + +### Bug Fixes + +* Allow passing gax instance to client constructor ([#186](https://github.com/googleapis/nodejs-functions/issues/186)) ([2ab984e](https://github.com/googleapis/nodejs-functions/commit/2ab984e032f5062862f0ce0fbe65d18bbbc421f1)) +* Better support for fallback mode ([#181](https://github.com/googleapis/nodejs-functions/issues/181)) ([aeaefd4](https://github.com/googleapis/nodejs-functions/commit/aeaefd4debab32e91a0078a342acc15c501281f8)) +* Change import long to require ([#182](https://github.com/googleapis/nodejs-functions/issues/182)) ([1c02a68](https://github.com/googleapis/nodejs-functions/commit/1c02a6842e99c5a0db5eff94b46ca3551f0b13a0)) +* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-functions/issues/1553)) ([#185](https://github.com/googleapis/nodejs-functions/issues/185)) ([b5748ed](https://github.com/googleapis/nodejs-functions/commit/b5748ed5154722907fd407c8bc6fd300a8fdaf21)) +* Remove pip install statements ([#1546](https://github.com/googleapis/nodejs-functions/issues/1546)) ([#184](https://github.com/googleapis/nodejs-functions/issues/184)) ([a8ffbb1](https://github.com/googleapis/nodejs-functions/commit/a8ffbb17e77a95ea23a1f4043c50a17faaa66b7e)) + ## [2.2.0](https://github.com/googleapis/nodejs-functions/compare/v2.1.0...v2.2.0) (2022-07-14) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 70519416741..c7590b2095f 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "2.2.0", + "version": "2.2.1", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index 1e5bd20b34f..98fa88b17ad 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.0", + "version": "2.2.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json index c0039628b49..7d7a251e745 100644 --- a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json +++ b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.0", + "version": "2.2.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json index cccb5e218d0..c76b8d997d6 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json +++ b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.0", + "version": "2.2.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json index f8bffa482a5..cc2075b5e4a 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json +++ b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.0", + "version": "2.2.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 9a468bf1d25..70d0616ecd3 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^2.2.0" + "@google-cloud/functions": "^2.2.1" }, "devDependencies": { "c8": "^7.1.0", From e971b4f157b756f3fe5af8c95dca09b30b0ea333 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 21 Sep 2022 10:28:36 -0700 Subject: [PATCH 117/123] fix: preserve default values in x-goog-request-params header (#187) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-typescript v2.17.0 PiperOrigin-RevId: 474338479 Source-Link: https://github.com/googleapis/googleapis/commit/d5d35e0353b59719e8917103b1bc7df2782bf6ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/efcd3f93962a103f68f003e2a1eecde6fa216a27 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: use fully qualified request type name in tests PiperOrigin-RevId: 475685359 Source-Link: https://github.com/googleapis/googleapis/commit/7a129736313ceb1f277c3b7f7e16d2e04cc901dd Source-Link: https://github.com/googleapis/googleapis-gen/commit/370c729e2ba062a167449c27882ba5f379c5c34d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../src/v1/cloud_functions_service_client.ts | 26 +- .../src/v2/function_service_client.ts | 20 +- .../src/v2alpha/function_service_client.ts | 20 +- .../src/v2beta/function_service_client.ts | 20 +- .../test/gapic_cloud_functions_service_v1.ts | 1149 +++++++++-------- .../test/gapic_function_service_v2.ts | 897 +++++++------ .../test/gapic_function_service_v2alpha.ts | 897 +++++++------ .../test/gapic_function_service_v2beta.ts | 897 +++++++------ 8 files changed, 2080 insertions(+), 1846 deletions(-) diff --git a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts index 69bdb0207cd..ec50ac18f9a 100644 --- a/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -496,7 +496,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getFunction(request, options, callback); @@ -586,7 +586,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.callFunction(request, options, callback); @@ -720,7 +720,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.generateUploadUrl(request, options, callback); @@ -819,7 +819,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.generateDownloadUrl(request, options, callback); @@ -915,7 +915,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - resource: request.resource || '', + resource: request.resource ?? '', }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); @@ -1004,7 +1004,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - resource: request.resource || '', + resource: request.resource ?? '', }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); @@ -1096,7 +1096,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - resource: request.resource || '', + resource: request.resource ?? '', }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); @@ -1205,7 +1205,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - location: request.location || '', + location: request.location ?? '', }); this.initialize(); return this.innerApiCalls.createFunction(request, options, callback); @@ -1345,7 +1345,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'function.name': request.function!.name || '', + 'function.name': request.function!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateFunction(request, options, callback); @@ -1485,7 +1485,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteFunction(request, options, callback); @@ -1626,7 +1626,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listFunctions(request, options, callback); @@ -1672,7 +1672,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listFunctions']; const callSettings = defaultCallSettings.merge(options); @@ -1727,7 +1727,7 @@ export class CloudFunctionsServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listFunctions']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-functions/src/v2/function_service_client.ts b/packages/google-cloud-functions/src/v2/function_service_client.ts index b0ee96abfb2..e76de0b1b5d 100644 --- a/packages/google-cloud-functions/src/v2/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2/function_service_client.ts @@ -544,7 +544,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getFunction(request, options, callback); @@ -658,7 +658,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.generateUploadUrl(request, options, callback); @@ -754,7 +754,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.generateDownloadUrl(request, options, callback); @@ -843,7 +843,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listRuntimes(request, options, callback); @@ -958,7 +958,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createFunction(request, options, callback); @@ -1100,7 +1100,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'function.name': request.function!.name || '', + 'function.name': request.function!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateFunction(request, options, callback); @@ -1240,7 +1240,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteFunction(request, options, callback); @@ -1388,7 +1388,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listFunctions(request, options, callback); @@ -1441,7 +1441,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listFunctions']; const callSettings = defaultCallSettings.merge(options); @@ -1503,7 +1503,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listFunctions']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts index df1b3ff757b..f6cbbdde393 100644 --- a/packages/google-cloud-functions/src/v2alpha/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts @@ -550,7 +550,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getFunction(request, options, callback); @@ -670,7 +670,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.generateUploadUrl(request, options, callback); @@ -772,7 +772,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.generateDownloadUrl(request, options, callback); @@ -867,7 +867,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listRuntimes(request, options, callback); @@ -982,7 +982,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createFunction(request, options, callback); @@ -1124,7 +1124,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'function.name': request.function!.name || '', + 'function.name': request.function!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateFunction(request, options, callback); @@ -1264,7 +1264,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteFunction(request, options, callback); @@ -1412,7 +1412,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listFunctions(request, options, callback); @@ -1465,7 +1465,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listFunctions']; const callSettings = defaultCallSettings.merge(options); @@ -1527,7 +1527,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listFunctions']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-functions/src/v2beta/function_service_client.ts b/packages/google-cloud-functions/src/v2beta/function_service_client.ts index 8dc52a9b4b1..e9ec2bce7b0 100644 --- a/packages/google-cloud-functions/src/v2beta/function_service_client.ts +++ b/packages/google-cloud-functions/src/v2beta/function_service_client.ts @@ -550,7 +550,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getFunction(request, options, callback); @@ -670,7 +670,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.generateUploadUrl(request, options, callback); @@ -772,7 +772,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.generateDownloadUrl(request, options, callback); @@ -867,7 +867,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listRuntimes(request, options, callback); @@ -982,7 +982,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createFunction(request, options, callback); @@ -1124,7 +1124,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'function.name': request.function!.name || '', + 'function.name': request.function!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateFunction(request, options, callback); @@ -1264,7 +1264,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteFunction(request, options, callback); @@ -1412,7 +1412,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listFunctions(request, options, callback); @@ -1465,7 +1465,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listFunctions']; const callSettings = defaultCallSettings.merge(options); @@ -1527,7 +1527,7 @@ export class FunctionServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listFunctions']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts index 5d04db61279..b3267f13b8c 100644 --- a/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -27,6 +27,21 @@ 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 @@ -263,26 +278,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.CloudFunction() ); client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); const [response] = await client.getFunction(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction without error using callback', async () => { @@ -295,15 +310,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.CloudFunction() ); @@ -326,11 +338,14 @@ describe('v1.CloudFunctionsServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction with error', async () => { @@ -343,26 +358,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getFunction = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getFunction(request), expectedError); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction with closed client', async () => { @@ -375,7 +390,11 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GetFunctionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getFunction(request), expectedError); @@ -393,26 +412,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CallFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionResponse() ); client.innerApiCalls.callFunction = stubSimpleCall(expectedResponse); const [response] = await client.callFunction(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.callFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.callFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.callFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes callFunction without error using callback', async () => { @@ -425,15 +444,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CallFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionResponse() ); @@ -456,11 +472,14 @@ describe('v1.CloudFunctionsServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.callFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.callFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.callFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes callFunction with error', async () => { @@ -473,26 +492,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CallFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.callFunction = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.callFunction(request), expectedError); - assert( - (client.innerApiCalls.callFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.callFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.callFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes callFunction with closed client', async () => { @@ -505,7 +524,11 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.CallFunctionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CallFunctionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.callFunction(request), expectedError); @@ -523,26 +546,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() ); client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); const [response] = await client.generateUploadUrl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl without error using callback', async () => { @@ -555,15 +578,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlResponse() ); @@ -586,11 +606,14 @@ describe('v1.CloudFunctionsServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl with error', async () => { @@ -603,26 +626,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.generateUploadUrl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.generateUploadUrl(request), expectedError); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl with closed client', async () => { @@ -635,7 +658,11 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateUploadUrlRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateUploadUrl(request), expectedError); @@ -653,15 +680,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() ); @@ -669,11 +693,14 @@ describe('v1.CloudFunctionsServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.generateDownloadUrl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl without error using callback', async () => { @@ -686,15 +713,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlResponse() ); @@ -717,11 +741,14 @@ describe('v1.CloudFunctionsServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl with error', async () => { @@ -734,26 +761,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.generateDownloadUrl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.generateDownloadUrl(request), expectedError); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl with closed client', async () => { @@ -766,7 +793,11 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.GenerateDownloadUrlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateDownloadUrl(request), expectedError); @@ -784,26 +815,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + 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); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + 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 () => { @@ -816,15 +847,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); @@ -847,11 +875,14 @@ describe('v1.CloudFunctionsServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + 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 () => { @@ -864,26 +895,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + 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); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + 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 () => { @@ -896,7 +927,11 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - request.resource = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setIamPolicy(request), expectedError); @@ -914,26 +949,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + 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); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + 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 () => { @@ -946,15 +981,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); @@ -977,11 +1009,14 @@ describe('v1.CloudFunctionsServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + 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 () => { @@ -994,26 +1029,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + 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); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + 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 () => { @@ -1026,7 +1061,11 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - request.resource = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getIamPolicy(request), expectedError); @@ -1044,15 +1083,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsResponse() ); @@ -1060,11 +1096,14 @@ describe('v1.CloudFunctionsServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.testIamPermissions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + 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 () => { @@ -1077,15 +1116,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsResponse() ); @@ -1108,11 +1144,14 @@ describe('v1.CloudFunctionsServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + 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 () => { @@ -1125,26 +1164,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + 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); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + 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 () => { @@ -1157,7 +1196,11 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - request.resource = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); + request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.testIamPermissions(request), expectedError); @@ -1175,15 +1218,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.CreateFunctionRequest() ); - request.location = ''; - const expectedHeaderRequestParams = 'location='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CreateFunctionRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1192,11 +1232,14 @@ describe('v1.CloudFunctionsServiceClient', () => { const [operation] = await client.createFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction without error using callback', async () => { @@ -1209,15 +1252,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.CreateFunctionRequest() ); - request.location = ''; - const expectedHeaderRequestParams = 'location='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CreateFunctionRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1247,11 +1287,14 @@ describe('v1.CloudFunctionsServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction with call error', async () => { @@ -1264,26 +1307,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.CreateFunctionRequest() ); - request.location = ''; - const expectedHeaderRequestParams = 'location='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CreateFunctionRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.createFunction(request), expectedError); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction with LRO error', async () => { @@ -1296,15 +1339,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.CreateFunctionRequest() ); - request.location = ''; - const expectedHeaderRequestParams = 'location='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CreateFunctionRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createFunction = stubLongRunningCall( undefined, @@ -1313,11 +1353,14 @@ describe('v1.CloudFunctionsServiceClient', () => { ); const [operation] = await client.createFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkCreateFunctionProgress without error', async () => { @@ -1375,16 +1418,13 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1393,11 +1433,14 @@ describe('v1.CloudFunctionsServiceClient', () => { const [operation] = await client.updateFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction without error using callback', async () => { @@ -1410,16 +1453,13 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1449,11 +1489,14 @@ describe('v1.CloudFunctionsServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction with call error', async () => { @@ -1466,27 +1509,27 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.updateFunction(request), expectedError); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction with LRO error', async () => { @@ -1499,16 +1542,13 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateFunction = stubLongRunningCall( undefined, @@ -1517,11 +1557,14 @@ describe('v1.CloudFunctionsServiceClient', () => { ); const [operation] = await client.updateFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkUpdateFunctionProgress without error', async () => { @@ -1579,15 +1622,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1596,11 +1636,14 @@ describe('v1.CloudFunctionsServiceClient', () => { const [operation] = await client.deleteFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction without error using callback', async () => { @@ -1613,15 +1656,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1651,11 +1691,14 @@ describe('v1.CloudFunctionsServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction with call error', async () => { @@ -1668,26 +1711,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.deleteFunction(request), expectedError); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction with LRO error', async () => { @@ -1700,15 +1743,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteFunction = stubLongRunningCall( undefined, @@ -1717,11 +1757,14 @@ describe('v1.CloudFunctionsServiceClient', () => { ); const [operation] = await client.deleteFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteFunctionProgress without error', async () => { @@ -1779,15 +1822,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v1.CloudFunction() @@ -1802,11 +1842,14 @@ describe('v1.CloudFunctionsServiceClient', () => { client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); const [response] = await client.listFunctions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctions without error using callback', async () => { @@ -1819,15 +1862,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v1.CloudFunction() @@ -1858,11 +1898,14 @@ describe('v1.CloudFunctionsServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctions with error', async () => { @@ -1875,26 +1918,26 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listFunctions = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listFunctions(request), expectedError); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctionsStream without error', async () => { @@ -1907,8 +1950,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v1.CloudFunction() @@ -1945,11 +1992,12 @@ describe('v1.CloudFunctionsServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listFunctions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1963,8 +2011,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1990,11 +2042,12 @@ describe('v1.CloudFunctionsServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listFunctions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2008,8 +2061,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v1.CloudFunction() @@ -2035,11 +2092,12 @@ describe('v1.CloudFunctionsServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -2053,8 +2111,12 @@ describe('v1.CloudFunctionsServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v1.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -2071,11 +2133,12 @@ describe('v1.CloudFunctionsServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2.ts b/packages/google-cloud-functions/test/gapic_function_service_v2.ts index 5d0f0039da8..5faa2a7645d 100644 --- a/packages/google-cloud-functions/test/gapic_function_service_v2.ts +++ b/packages/google-cloud-functions/test/gapic_function_service_v2.ts @@ -33,6 +33,21 @@ import { 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 @@ -260,26 +275,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2.Function() ); client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); const [response] = await client.getFunction(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction without error using callback', async () => { @@ -291,15 +306,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2.Function() ); @@ -322,11 +334,14 @@ describe('v2.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction with error', async () => { @@ -338,26 +353,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getFunction = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getFunction(request), expectedError); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction with closed client', async () => { @@ -369,7 +384,11 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GetFunctionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getFunction(request), expectedError); @@ -386,26 +405,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() ); client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); const [response] = await client.generateUploadUrl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl without error using callback', async () => { @@ -417,15 +436,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateUploadUrlResponse() ); @@ -448,11 +464,14 @@ describe('v2.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl with error', async () => { @@ -464,26 +483,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.generateUploadUrl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.generateUploadUrl(request), expectedError); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl with closed client', async () => { @@ -495,7 +514,11 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateUploadUrlRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateUploadUrl(request), expectedError); @@ -512,15 +535,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() ); @@ -528,11 +548,14 @@ describe('v2.FunctionServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.generateDownloadUrl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl without error using callback', async () => { @@ -544,15 +567,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateDownloadUrlResponse() ); @@ -575,11 +595,14 @@ describe('v2.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl with error', async () => { @@ -591,26 +614,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.generateDownloadUrl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.generateDownloadUrl(request), expectedError); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl with closed client', async () => { @@ -622,7 +645,11 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.GenerateDownloadUrlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateDownloadUrl(request), expectedError); @@ -639,26 +666,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2.ListRuntimesResponse() ); client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); const [response] = await client.listRuntimes(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes without error using callback', async () => { @@ -670,15 +697,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2.ListRuntimesResponse() ); @@ -701,11 +725,14 @@ describe('v2.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes with error', async () => { @@ -717,26 +744,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listRuntimes = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listRuntimes(request), expectedError); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes with closed client', async () => { @@ -748,7 +775,11 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListRuntimesRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.listRuntimes(request), expectedError); @@ -765,15 +796,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -782,11 +810,14 @@ describe('v2.FunctionServiceClient', () => { const [operation] = await client.createFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction without error using callback', async () => { @@ -798,15 +829,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -836,11 +864,14 @@ describe('v2.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction with call error', async () => { @@ -852,26 +883,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.createFunction(request), expectedError); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction with LRO error', async () => { @@ -883,15 +914,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createFunction = stubLongRunningCall( undefined, @@ -900,11 +928,14 @@ describe('v2.FunctionServiceClient', () => { ); const [operation] = await client.createFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkCreateFunctionProgress without error', async () => { @@ -959,16 +990,13 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -977,11 +1005,14 @@ describe('v2.FunctionServiceClient', () => { const [operation] = await client.updateFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction without error using callback', async () => { @@ -993,16 +1024,13 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1032,11 +1060,14 @@ describe('v2.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction with call error', async () => { @@ -1048,27 +1079,27 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.updateFunction(request), expectedError); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction with LRO error', async () => { @@ -1080,16 +1111,13 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateFunction = stubLongRunningCall( undefined, @@ -1098,11 +1126,14 @@ describe('v2.FunctionServiceClient', () => { ); const [operation] = await client.updateFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkUpdateFunctionProgress without error', async () => { @@ -1157,15 +1188,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1174,11 +1202,14 @@ describe('v2.FunctionServiceClient', () => { const [operation] = await client.deleteFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction without error using callback', async () => { @@ -1190,15 +1221,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1228,11 +1256,14 @@ describe('v2.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction with call error', async () => { @@ -1244,26 +1275,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.deleteFunction(request), expectedError); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction with LRO error', async () => { @@ -1275,15 +1306,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteFunction = stubLongRunningCall( undefined, @@ -1292,11 +1320,14 @@ describe('v2.FunctionServiceClient', () => { ); const [operation] = await client.deleteFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteFunctionProgress without error', async () => { @@ -1351,15 +1382,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.functions.v2.Function()), generateSampleMessage(new protos.google.cloud.functions.v2.Function()), @@ -1368,11 +1396,14 @@ describe('v2.FunctionServiceClient', () => { client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); const [response] = await client.listFunctions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctions without error using callback', async () => { @@ -1384,15 +1415,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.functions.v2.Function()), generateSampleMessage(new protos.google.cloud.functions.v2.Function()), @@ -1417,11 +1445,14 @@ describe('v2.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctions with error', async () => { @@ -1433,26 +1464,26 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listFunctions = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listFunctions(request), expectedError); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctionsStream without error', async () => { @@ -1464,8 +1495,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.functions.v2.Function()), generateSampleMessage(new protos.google.cloud.functions.v2.Function()), @@ -1496,11 +1531,12 @@ describe('v2.FunctionServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listFunctions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1513,8 +1549,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1540,11 +1580,12 @@ describe('v2.FunctionServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listFunctions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1557,8 +1598,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.functions.v2.Function()), generateSampleMessage(new protos.google.cloud.functions.v2.Function()), @@ -1578,11 +1623,12 @@ describe('v2.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1595,8 +1641,12 @@ describe('v2.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1613,11 +1663,12 @@ describe('v2.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2092,12 +2143,15 @@ describe('v2.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -2128,12 +2182,15 @@ describe('v2.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts b/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts index d3646e4427d..088c6c7c94c 100644 --- a/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts +++ b/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts @@ -33,6 +33,21 @@ import { 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 @@ -260,26 +275,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2alpha.Function() ); client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); const [response] = await client.getFunction(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction without error using callback', async () => { @@ -291,15 +306,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2alpha.Function() ); @@ -322,11 +334,14 @@ describe('v2alpha.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction with error', async () => { @@ -338,26 +353,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getFunction = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getFunction(request), expectedError); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction with closed client', async () => { @@ -369,7 +384,11 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GetFunctionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getFunction(request), expectedError); @@ -386,26 +405,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse() ); client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); const [response] = await client.generateUploadUrl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl without error using callback', async () => { @@ -417,15 +436,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateUploadUrlResponse() ); @@ -448,11 +464,14 @@ describe('v2alpha.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl with error', async () => { @@ -464,26 +483,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.generateUploadUrl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.generateUploadUrl(request), expectedError); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl with closed client', async () => { @@ -495,7 +514,11 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateUploadUrlRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateUploadUrl(request), expectedError); @@ -512,15 +535,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse() ); @@ -528,11 +548,14 @@ describe('v2alpha.FunctionServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.generateDownloadUrl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl without error using callback', async () => { @@ -544,15 +567,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlResponse() ); @@ -575,11 +595,14 @@ describe('v2alpha.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl with error', async () => { @@ -591,26 +614,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.generateDownloadUrl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.generateDownloadUrl(request), expectedError); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl with closed client', async () => { @@ -622,7 +645,11 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateDownloadUrl(request), expectedError); @@ -639,26 +666,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListRuntimesResponse() ); client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); const [response] = await client.listRuntimes(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes without error using callback', async () => { @@ -670,15 +697,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListRuntimesResponse() ); @@ -701,11 +725,14 @@ describe('v2alpha.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes with error', async () => { @@ -717,26 +744,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listRuntimes = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listRuntimes(request), expectedError); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes with closed client', async () => { @@ -748,7 +775,11 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListRuntimesRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.listRuntimes(request), expectedError); @@ -765,15 +796,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -782,11 +810,14 @@ describe('v2alpha.FunctionServiceClient', () => { const [operation] = await client.createFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction without error using callback', async () => { @@ -798,15 +829,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -836,11 +864,14 @@ describe('v2alpha.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction with call error', async () => { @@ -852,26 +883,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.createFunction(request), expectedError); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction with LRO error', async () => { @@ -883,15 +914,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createFunction = stubLongRunningCall( undefined, @@ -900,11 +928,14 @@ describe('v2alpha.FunctionServiceClient', () => { ); const [operation] = await client.createFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkCreateFunctionProgress without error', async () => { @@ -959,16 +990,13 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -977,11 +1005,14 @@ describe('v2alpha.FunctionServiceClient', () => { const [operation] = await client.updateFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction without error using callback', async () => { @@ -993,16 +1024,13 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1032,11 +1060,14 @@ describe('v2alpha.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction with call error', async () => { @@ -1048,27 +1079,27 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.updateFunction(request), expectedError); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction with LRO error', async () => { @@ -1080,16 +1111,13 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateFunction = stubLongRunningCall( undefined, @@ -1098,11 +1126,14 @@ describe('v2alpha.FunctionServiceClient', () => { ); const [operation] = await client.updateFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkUpdateFunctionProgress without error', async () => { @@ -1157,15 +1188,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1174,11 +1202,14 @@ describe('v2alpha.FunctionServiceClient', () => { const [operation] = await client.deleteFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction without error using callback', async () => { @@ -1190,15 +1221,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1228,11 +1256,14 @@ describe('v2alpha.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction with call error', async () => { @@ -1244,26 +1275,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.deleteFunction(request), expectedError); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction with LRO error', async () => { @@ -1275,15 +1306,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteFunction = stubLongRunningCall( undefined, @@ -1292,11 +1320,14 @@ describe('v2alpha.FunctionServiceClient', () => { ); const [operation] = await client.deleteFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteFunctionProgress without error', async () => { @@ -1351,15 +1382,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v2alpha.Function() @@ -1374,11 +1402,14 @@ describe('v2alpha.FunctionServiceClient', () => { client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); const [response] = await client.listFunctions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctions without error using callback', async () => { @@ -1390,15 +1421,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v2alpha.Function() @@ -1429,11 +1457,14 @@ describe('v2alpha.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctions with error', async () => { @@ -1445,26 +1476,26 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listFunctions = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listFunctions(request), expectedError); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctionsStream without error', async () => { @@ -1476,8 +1507,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v2alpha.Function() @@ -1514,11 +1549,12 @@ describe('v2alpha.FunctionServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listFunctions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1531,8 +1567,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1558,11 +1598,12 @@ describe('v2alpha.FunctionServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listFunctions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1575,8 +1616,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v2alpha.Function() @@ -1602,11 +1647,12 @@ describe('v2alpha.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1619,8 +1665,12 @@ describe('v2alpha.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2alpha.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1637,11 +1687,12 @@ describe('v2alpha.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2116,12 +2167,15 @@ describe('v2alpha.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -2152,12 +2206,15 @@ describe('v2alpha.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts b/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts index 333819a8e48..c314ec86fef 100644 --- a/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts +++ b/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts @@ -33,6 +33,21 @@ import { 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 @@ -260,26 +275,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2beta.Function() ); client.innerApiCalls.getFunction = stubSimpleCall(expectedResponse); const [response] = await client.getFunction(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction without error using callback', async () => { @@ -291,15 +306,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2beta.Function() ); @@ -322,11 +334,14 @@ describe('v2beta.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction with error', async () => { @@ -338,26 +353,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GetFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getFunction = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getFunction(request), expectedError); - assert( - (client.innerApiCalls.getFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getFunction with closed client', async () => { @@ -369,7 +384,11 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GetFunctionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GetFunctionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getFunction(request), expectedError); @@ -386,26 +405,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse() ); client.innerApiCalls.generateUploadUrl = stubSimpleCall(expectedResponse); const [response] = await client.generateUploadUrl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl without error using callback', async () => { @@ -417,15 +436,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateUploadUrlResponse() ); @@ -448,11 +464,14 @@ describe('v2beta.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl with error', async () => { @@ -464,26 +483,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.generateUploadUrl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.generateUploadUrl(request), expectedError); - assert( - (client.innerApiCalls.generateUploadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateUploadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateUploadUrl with closed client', async () => { @@ -495,7 +514,11 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateUploadUrlRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GenerateUploadUrlRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateUploadUrl(request), expectedError); @@ -512,15 +535,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse() ); @@ -528,11 +548,14 @@ describe('v2beta.FunctionServiceClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.generateDownloadUrl(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl without error using callback', async () => { @@ -544,15 +567,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateDownloadUrlResponse() ); @@ -575,11 +595,14 @@ describe('v2beta.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl with error', async () => { @@ -591,26 +614,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.generateDownloadUrl = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.generateDownloadUrl(request), expectedError); - assert( - (client.innerApiCalls.generateDownloadUrl as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateDownloadUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes generateDownloadUrl with closed client', async () => { @@ -622,7 +645,11 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.GenerateDownloadUrlRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.GenerateDownloadUrlRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.generateDownloadUrl(request), expectedError); @@ -639,26 +666,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListRuntimesResponse() ); client.innerApiCalls.listRuntimes = stubSimpleCall(expectedResponse); const [response] = await client.listRuntimes(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes without error using callback', async () => { @@ -670,15 +697,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListRuntimesResponse() ); @@ -701,11 +725,14 @@ describe('v2beta.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes with error', async () => { @@ -717,26 +744,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListRuntimesRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listRuntimes = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listRuntimes(request), expectedError); - assert( - (client.innerApiCalls.listRuntimes as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRuntimes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listRuntimes with closed client', async () => { @@ -748,7 +775,11 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListRuntimesRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListRuntimesRequest', + ['parent'] + ); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.listRuntimes(request), expectedError); @@ -765,15 +796,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -782,11 +810,14 @@ describe('v2beta.FunctionServiceClient', () => { const [operation] = await client.createFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction without error using callback', async () => { @@ -798,15 +829,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -836,11 +864,14 @@ describe('v2beta.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction with call error', async () => { @@ -852,26 +883,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.createFunction(request), expectedError); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createFunction with LRO error', async () => { @@ -883,15 +914,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.CreateFunctionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createFunction = stubLongRunningCall( undefined, @@ -900,11 +928,14 @@ describe('v2beta.FunctionServiceClient', () => { ); const [operation] = await client.createFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkCreateFunctionProgress without error', async () => { @@ -959,16 +990,13 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -977,11 +1005,14 @@ describe('v2beta.FunctionServiceClient', () => { const [operation] = await client.updateFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction without error using callback', async () => { @@ -993,16 +1024,13 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1032,11 +1060,14 @@ describe('v2beta.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction with call error', async () => { @@ -1048,27 +1079,27 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.updateFunction(request), expectedError); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateFunction with LRO error', async () => { @@ -1080,16 +1111,13 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.UpdateFunctionRequest() ); - request.function = {}; - request.function.name = ''; - const expectedHeaderRequestParams = 'function.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.function ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.UpdateFunctionRequest', + ['function', 'name'] + ); + request.function.name = defaultValue1; + const expectedHeaderRequestParams = `function.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateFunction = stubLongRunningCall( undefined, @@ -1098,11 +1126,14 @@ describe('v2beta.FunctionServiceClient', () => { ); const [operation] = await client.updateFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.updateFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkUpdateFunctionProgress without error', async () => { @@ -1157,15 +1188,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1174,11 +1202,14 @@ describe('v2beta.FunctionServiceClient', () => { const [operation] = await client.deleteFunction(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction without error using callback', async () => { @@ -1190,15 +1221,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -1228,11 +1256,14 @@ describe('v2beta.FunctionServiceClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction with call error', async () => { @@ -1244,26 +1275,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteFunction = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.deleteFunction(request), expectedError); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteFunction with LRO error', async () => { @@ -1275,15 +1306,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.DeleteFunctionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteFunction = stubLongRunningCall( undefined, @@ -1292,11 +1320,14 @@ describe('v2beta.FunctionServiceClient', () => { ); const [operation] = await client.deleteFunction(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteFunction as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteFunction as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteFunctionProgress without error', async () => { @@ -1351,15 +1382,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v2beta.Function() @@ -1374,11 +1402,14 @@ describe('v2beta.FunctionServiceClient', () => { client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); const [response] = await client.listFunctions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctions without error using callback', async () => { @@ -1390,15 +1421,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v2beta.Function() @@ -1429,11 +1457,14 @@ describe('v2beta.FunctionServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctions with error', async () => { @@ -1445,26 +1476,26 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listFunctions = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listFunctions(request), expectedError); - assert( - (client.innerApiCalls.listFunctions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFunctions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listFunctionsStream without error', async () => { @@ -1476,8 +1507,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v2beta.Function() @@ -1514,11 +1549,12 @@ describe('v2beta.FunctionServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listFunctions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1531,8 +1567,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listFunctions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1558,11 +1598,12 @@ describe('v2beta.FunctionServiceClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listFunctions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1575,8 +1616,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.functions.v2beta.Function() @@ -1602,11 +1647,12 @@ describe('v2beta.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1619,8 +1665,12 @@ describe('v2beta.FunctionServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.functions.v2beta.ListFunctionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.ListFunctionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listFunctions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1637,11 +1687,12 @@ describe('v2beta.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listFunctions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -2116,12 +2167,15 @@ describe('v2beta.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -2152,12 +2206,15 @@ describe('v2beta.FunctionServiceClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); From e2494adad6750cb6fca031c8ba952705bfa7d6d9 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 22 Sep 2022 14:56:00 -0700 Subject: [PATCH 118/123] chore(main): release 2.2.2 (#189) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 2.2.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-functions/CHANGELOG.md | 7 +++++++ packages/google-cloud-functions/package.json | 2 +- .../v1/snippet_metadata.google.cloud.functions.v1.json | 2 +- .../v2/snippet_metadata.google.cloud.functions.v2.json | 2 +- .../snippet_metadata.google.cloud.functions.v2alpha.json | 2 +- .../snippet_metadata.google.cloud.functions.v2beta.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 7 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 57dd7d4df44..38f635d101e 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.2.2](https://github.com/googleapis/nodejs-functions/compare/v2.2.1...v2.2.2) (2022-09-21) + + +### Bug Fixes + +* Preserve default values in x-goog-request-params header ([#187](https://github.com/googleapis/nodejs-functions/issues/187)) ([57b025c](https://github.com/googleapis/nodejs-functions/commit/57b025c07d850812a246db7e61521a968f0cd20a)) + ## [2.2.1](https://github.com/googleapis/nodejs-functions/compare/v2.2.0...v2.2.1) (2022-09-01) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index c7590b2095f..b7075a1d0af 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "2.2.1", + "version": "2.2.2", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index 98fa88b17ad..8c0207a9b7c 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.1", + "version": "2.2.2", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json index 7d7a251e745..9bffaee6d18 100644 --- a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json +++ b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.1", + "version": "2.2.2", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json index c76b8d997d6..6cc44f4dfc7 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json +++ b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.1", + "version": "2.2.2", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json index cc2075b5e4a..352866429b7 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json +++ b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.1", + "version": "2.2.2", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 70d0616ecd3..4c760c41520 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^2.2.1" + "@google-cloud/functions": "^2.2.2" }, "devDependencies": { "c8": "^7.1.0", From 4d456c0bbe3f1a16f32b50e372d1ccfc9b0144d3 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 3 Nov 2022 23:47:16 -0700 Subject: [PATCH 119/123] fix(deps): use google-gax v3.5.2 (#201) --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index b7075a1d0af..f0ac163f844 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -39,7 +39,7 @@ "test": "c8 mocha build/test" }, "dependencies": { - "google-gax": "^3.3.0" + "google-gax": "^3.5.2" }, "devDependencies": { "@types/mocha": "^9.0.0", From d7d93c169a4f1f52e664394c243d33f4a12a8c79 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 10 Nov 2022 10:22:19 +0100 Subject: [PATCH 120/123] chore(deps): update dependency @types/node to v18 (#197) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`^16.0.0` -> `^18.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/16.18.3/18.11.9) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/compatibility-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/confidence-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index f0ac163f844..590a6b7869d 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -43,7 +43,7 @@ }, "devDependencies": { "@types/mocha": "^9.0.0", - "@types/node": "^16.0.0", + "@types/node": "^18.0.0", "@types/sinon": "^10.0.0", "c8": "^7.2.1", "gts": "^3.1.0", From e38b9847e0d82e3cbb24db84e98e56a55a9296c5 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 10 Nov 2022 11:16:37 +0100 Subject: [PATCH 121/123] chore(deps): update dependency jsdoc to v4 (#204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc](https://togithub.com/jsdoc/jsdoc) | [`^3.6.4` -> `^4.0.0`](https://renovatebot.com/diffs/npm/jsdoc/3.6.11/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/compatibility-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/confidence-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
jsdoc/jsdoc ### [`v4.0.0`](https://togithub.com/jsdoc/jsdoc/blob/HEAD/CHANGES.md#​400-November-2022) [Compare Source](https://togithub.com/jsdoc/jsdoc/compare/3.6.11...084218523a7d69fec14a852ce680f374f526af28) - JSDoc releases now use [semantic versioning](https://semver.org/). If JSDoc makes backwards-incompatible changes in the future, the major version will be incremented. - JSDoc no longer uses the [`taffydb`](https://taffydb.com/) package. If your JSDoc template or plugin uses the `taffydb` package, see the [instructions for replacing `taffydb` with `@jsdoc/salty`](https://togithub.com/jsdoc/jsdoc/tree/main/packages/jsdoc-salty#use-salty-in-a-jsdoc-template). - JSDoc now supports Node.js 12.0.0 and later.
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-functions). --- packages/google-cloud-functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index 590a6b7869d..b2d5fa15e80 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -47,7 +47,7 @@ "@types/sinon": "^10.0.0", "c8": "^7.2.1", "gts": "^3.1.0", - "jsdoc": "^3.6.4", + "jsdoc": "^4.0.0", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", "linkinator": "^4.0.0", From 3df72e53b3c1669e7854dd276097f3198d024203 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 11 Nov 2022 01:46:21 +0000 Subject: [PATCH 122/123] fix: regenerated protos JS and TS definitions (#205) samples: pull in latest typeless bot, clean up some comments Source-Link: https://togithub.com/googleapis/synthtool/commit/0a68e568b6911b60bb6fd452eba4848b176031d8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:5b05f26103855c3a15433141389c478d1d3fe088fb5d4e3217c4793f6b3f245e --- .../google-cloud-functions/protos/protos.d.ts | 2 +- .../google-cloud-functions/protos/protos.js | 388 +++++++++++++++--- 2 files changed, 340 insertions(+), 50 deletions(-) diff --git a/packages/google-cloud-functions/protos/protos.d.ts b/packages/google-cloud-functions/protos/protos.d.ts index a52644d7e7b..008a48a70a2 100644 --- a/packages/google-cloud-functions/protos/protos.d.ts +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Long = require("long"); import type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-functions/protos/protos.js b/packages/google-cloud-functions/protos/protos.js index 07fb29cfa1e..c9d5fbb11b3 100644 --- a/packages/google-cloud-functions/protos/protos.js +++ b/packages/google-cloud-functions/protos/protos.js @@ -1394,6 +1394,12 @@ message.eventTrigger = $root.google.cloud.functions.v1.EventTrigger.fromObject(object.eventTrigger); } switch (object.status) { + default: + if (typeof object.status === "number") { + message.status = object.status; + break; + } + break; case "CLOUD_FUNCTION_STATUS_UNSPECIFIED": case 0: message.status = 0; @@ -1476,6 +1482,12 @@ if (object.vpcConnector != null) message.vpcConnector = String(object.vpcConnector); switch (object.vpcConnectorEgressSettings) { + default: + if (typeof object.vpcConnectorEgressSettings === "number") { + message.vpcConnectorEgressSettings = object.vpcConnectorEgressSettings; + break; + } + break; case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": case 0: message.vpcConnectorEgressSettings = 0; @@ -1490,6 +1502,12 @@ break; } switch (object.ingressSettings) { + default: + if (typeof object.ingressSettings === "number") { + message.ingressSettings = object.ingressSettings; + break; + } + break; case "INGRESS_SETTINGS_UNSPECIFIED": case 0: message.ingressSettings = 0; @@ -1540,6 +1558,12 @@ if (object.dockerRepository != null) message.dockerRepository = String(object.dockerRepository); switch (object.dockerRegistry) { + default: + if (typeof object.dockerRegistry === "number") { + message.dockerRegistry = object.dockerRegistry; + break; + } + break; case "DOCKER_REGISTRY_UNSPECIFIED": case 0: message.dockerRegistry = 0; @@ -1632,7 +1656,7 @@ object.trigger = "eventTrigger"; } if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.google.cloud.functions.v1.CloudFunctionStatus[message.status] : message.status; + object.status = options.enums === String ? $root.google.cloud.functions.v1.CloudFunctionStatus[message.status] === undefined ? message.status : $root.google.cloud.functions.v1.CloudFunctionStatus[message.status] : message.status; if (message.entryPoint != null && message.hasOwnProperty("entryPoint")) object.entryPoint = message.entryPoint; if (message.timeout != null && message.hasOwnProperty("timeout")) @@ -1673,9 +1697,9 @@ if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) object.vpcConnector = message.vpcConnector; if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) - object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] === undefined ? message.vpcConnectorEgressSettings : $root.google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) - object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.IngressSettings[message.ingressSettings] : message.ingressSettings; + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.IngressSettings[message.ingressSettings] === undefined ? message.ingressSettings : $root.google.cloud.functions.v1.CloudFunction.IngressSettings[message.ingressSettings] : message.ingressSettings; if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) object.kmsKeyName = message.kmsKeyName; if (message.buildWorkerPool != null && message.hasOwnProperty("buildWorkerPool")) @@ -1706,7 +1730,7 @@ if (message.dockerRepository != null && message.hasOwnProperty("dockerRepository")) object.dockerRepository = message.dockerRepository; if (message.dockerRegistry != null && message.hasOwnProperty("dockerRegistry")) - object.dockerRegistry = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.DockerRegistry[message.dockerRegistry] : message.dockerRegistry; + object.dockerRegistry = options.enums === String ? $root.google.cloud.functions.v1.CloudFunction.DockerRegistry[message.dockerRegistry] === undefined ? message.dockerRegistry : $root.google.cloud.functions.v1.CloudFunction.DockerRegistry[message.dockerRegistry] : message.dockerRegistry; return object; }; @@ -2192,6 +2216,12 @@ if (object.url != null) message.url = String(object.url); switch (object.securityLevel) { + default: + if (typeof object.securityLevel === "number") { + message.securityLevel = object.securityLevel; + break; + } + break; case "SECURITY_LEVEL_UNSPECIFIED": case 0: message.securityLevel = 0; @@ -2228,7 +2258,7 @@ if (message.url != null && message.hasOwnProperty("url")) object.url = message.url; if (message.securityLevel != null && message.hasOwnProperty("securityLevel")) - object.securityLevel = options.enums === String ? $root.google.cloud.functions.v1.HttpsTrigger.SecurityLevel[message.securityLevel] : message.securityLevel; + object.securityLevel = options.enums === String ? $root.google.cloud.functions.v1.HttpsTrigger.SecurityLevel[message.securityLevel] === undefined ? message.securityLevel : $root.google.cloud.functions.v1.HttpsTrigger.SecurityLevel[message.securityLevel] : message.securityLevel; return object; }; @@ -6845,6 +6875,12 @@ if (object.target != null) message.target = String(object.target); switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "OPERATION_UNSPECIFIED": case 0: message.type = 0; @@ -6920,7 +6956,7 @@ if (message.target != null && message.hasOwnProperty("target")) object.target = message.target; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.functions.v1.OperationType[message.type] : message.type; + object.type = options.enums === String ? $root.google.cloud.functions.v1.OperationType[message.type] === undefined ? message.type : $root.google.cloud.functions.v1.OperationType[message.type] : message.type; if (message.request != null && message.hasOwnProperty("request")) object.request = $root.google.protobuf.Any.toObject(message.request, options); if (message.versionId != null && message.hasOwnProperty("versionId")) @@ -7668,6 +7704,12 @@ if (object.name != null) message.name = String(object.name); switch (object.environment) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; case "ENVIRONMENT_UNSPECIFIED": case 0: message.environment = 0; @@ -7699,6 +7741,12 @@ message.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.fromObject(object.eventTrigger); } switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -7787,7 +7835,7 @@ if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) object.eventTrigger = $root.google.cloud.functions.v2.EventTrigger.toObject(message.eventTrigger, options); if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.functions.v2.Function.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.functions.v2.Function.State[message.state] === undefined ? message.state : $root.google.cloud.functions.v2.Function.State[message.state] : message.state; if (message.updateTime != null && message.hasOwnProperty("updateTime")) object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); var keys2; @@ -7802,7 +7850,7 @@ object.stateMessages[j] = $root.google.cloud.functions.v2.StateMessage.toObject(message.stateMessages[j], options); } if (message.environment != null && message.hasOwnProperty("environment")) - object.environment = options.enums === String ? $root.google.cloud.functions.v2.Environment[message.environment] : message.environment; + object.environment = options.enums === String ? $root.google.cloud.functions.v2.Environment[message.environment] === undefined ? message.environment : $root.google.cloud.functions.v2.Environment[message.environment] : message.environment; return object; }; @@ -8050,6 +8098,12 @@ return object; var message = new $root.google.cloud.functions.v2.StateMessage(); switch (object.severity) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; case "SEVERITY_UNSPECIFIED": case 0: message.severity = 0; @@ -8093,7 +8147,7 @@ object.message = ""; } if (message.severity != null && message.hasOwnProperty("severity")) - object.severity = options.enums === String ? $root.google.cloud.functions.v2.StateMessage.Severity[message.severity] : message.severity; + object.severity = options.enums === String ? $root.google.cloud.functions.v2.StateMessage.Severity[message.severity] === undefined ? message.severity : $root.google.cloud.functions.v2.StateMessage.Severity[message.severity] : message.severity; if (message.type != null && message.hasOwnProperty("type")) object.type = message.type; if (message.message != null && message.hasOwnProperty("message")) @@ -10175,6 +10229,12 @@ if (object.vpcConnector != null) message.vpcConnector = String(object.vpcConnector); switch (object.vpcConnectorEgressSettings) { + default: + if (typeof object.vpcConnectorEgressSettings === "number") { + message.vpcConnectorEgressSettings = object.vpcConnectorEgressSettings; + break; + } + break; case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": case 0: message.vpcConnectorEgressSettings = 0; @@ -10189,6 +10249,12 @@ break; } switch (object.ingressSettings) { + default: + if (typeof object.ingressSettings === "number") { + message.ingressSettings = object.ingressSettings; + break; + } + break; case "INGRESS_SETTINGS_UNSPECIFIED": case 0: message.ingressSettings = 0; @@ -10285,9 +10351,9 @@ if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) object.vpcConnector = message.vpcConnector; if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) - object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] === undefined ? message.vpcConnectorEgressSettings : $root.google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) - object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2.ServiceConfig.IngressSettings[message.ingressSettings] === undefined ? message.ingressSettings : $root.google.cloud.functions.v2.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; if (message.uri != null && message.hasOwnProperty("uri")) object.uri = message.uri; if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) @@ -11483,6 +11549,12 @@ if (object.serviceAccountEmail != null) message.serviceAccountEmail = String(object.serviceAccountEmail); switch (object.retryPolicy) { + default: + if (typeof object.retryPolicy === "number") { + message.retryPolicy = object.retryPolicy; + break; + } + break; case "RETRY_POLICY_UNSPECIFIED": case 0: message.retryPolicy = 0; @@ -11541,7 +11613,7 @@ if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) object.serviceAccountEmail = message.serviceAccountEmail; if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) - object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; + object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2.EventTrigger.RetryPolicy[message.retryPolicy] === undefined ? message.retryPolicy : $root.google.cloud.functions.v2.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; if (message.channel != null && message.hasOwnProperty("channel")) object.channel = message.channel; return object; @@ -14863,6 +14935,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.stage) { + default: + if (typeof object.stage === "number") { + message.stage = object.stage; + break; + } + break; case "RUNTIME_STAGE_UNSPECIFIED": case 0: message.stage = 0; @@ -14900,6 +14978,12 @@ message.warnings[i] = String(object.warnings[i]); } switch (object.environment) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; case "ENVIRONMENT_UNSPECIFIED": case 0: message.environment = 0; @@ -14940,14 +15024,14 @@ if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.stage != null && message.hasOwnProperty("stage")) - object.stage = options.enums === String ? $root.google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; + object.stage = options.enums === String ? $root.google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage[message.stage] === undefined ? message.stage : $root.google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; if (message.warnings && message.warnings.length) { object.warnings = []; for (var j = 0; j < message.warnings.length; ++j) object.warnings[j] = message.warnings[j]; } if (message.environment != null && message.hasOwnProperty("environment")) - object.environment = options.enums === String ? $root.google.cloud.functions.v2.Environment[message.environment] : message.environment; + object.environment = options.enums === String ? $root.google.cloud.functions.v2.Environment[message.environment] === undefined ? message.environment : $root.google.cloud.functions.v2.Environment[message.environment] : message.environment; if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; return object; @@ -15701,6 +15785,12 @@ return object; var message = new $root.google.cloud.functions.v2.Stage(); switch (object.name) { + default: + if (typeof object.name === "number") { + message.name = object.name; + break; + } + break; case "NAME_UNSPECIFIED": case 0: message.name = 0; @@ -15733,6 +15823,12 @@ if (object.message != null) message.message = String(object.message); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -15790,11 +15886,11 @@ object.resourceUri = ""; } if (message.name != null && message.hasOwnProperty("name")) - object.name = options.enums === String ? $root.google.cloud.functions.v2.Stage.Name[message.name] : message.name; + object.name = options.enums === String ? $root.google.cloud.functions.v2.Stage.Name[message.name] === undefined ? message.name : $root.google.cloud.functions.v2.Stage.Name[message.name] : message.name; if (message.message != null && message.hasOwnProperty("message")) object.message = message.message; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.functions.v2.Stage.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.functions.v2.Stage.State[message.state] === undefined ? message.state : $root.google.cloud.functions.v2.Stage.State[message.state] : message.state; if (message.resource != null && message.hasOwnProperty("resource")) object.resource = message.resource; if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) @@ -16578,6 +16674,12 @@ if (object.name != null) message.name = String(object.name); switch (object.environment) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; case "ENVIRONMENT_UNSPECIFIED": case 0: message.environment = 0; @@ -16609,6 +16711,12 @@ message.eventTrigger = $root.google.cloud.functions.v2alpha.EventTrigger.fromObject(object.eventTrigger); } switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -16697,7 +16805,7 @@ if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) object.eventTrigger = $root.google.cloud.functions.v2alpha.EventTrigger.toObject(message.eventTrigger, options); if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.functions.v2alpha.Function.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.functions.v2alpha.Function.State[message.state] === undefined ? message.state : $root.google.cloud.functions.v2alpha.Function.State[message.state] : message.state; if (message.updateTime != null && message.hasOwnProperty("updateTime")) object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); var keys2; @@ -16712,7 +16820,7 @@ object.stateMessages[j] = $root.google.cloud.functions.v2alpha.StateMessage.toObject(message.stateMessages[j], options); } if (message.environment != null && message.hasOwnProperty("environment")) - object.environment = options.enums === String ? $root.google.cloud.functions.v2alpha.Environment[message.environment] : message.environment; + object.environment = options.enums === String ? $root.google.cloud.functions.v2alpha.Environment[message.environment] === undefined ? message.environment : $root.google.cloud.functions.v2alpha.Environment[message.environment] : message.environment; return object; }; @@ -16960,6 +17068,12 @@ return object; var message = new $root.google.cloud.functions.v2alpha.StateMessage(); switch (object.severity) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; case "SEVERITY_UNSPECIFIED": case 0: message.severity = 0; @@ -17003,7 +17117,7 @@ object.message = ""; } if (message.severity != null && message.hasOwnProperty("severity")) - object.severity = options.enums === String ? $root.google.cloud.functions.v2alpha.StateMessage.Severity[message.severity] : message.severity; + object.severity = options.enums === String ? $root.google.cloud.functions.v2alpha.StateMessage.Severity[message.severity] === undefined ? message.severity : $root.google.cloud.functions.v2alpha.StateMessage.Severity[message.severity] : message.severity; if (message.type != null && message.hasOwnProperty("type")) object.type = message.type; if (message.message != null && message.hasOwnProperty("message")) @@ -19085,6 +19199,12 @@ if (object.vpcConnector != null) message.vpcConnector = String(object.vpcConnector); switch (object.vpcConnectorEgressSettings) { + default: + if (typeof object.vpcConnectorEgressSettings === "number") { + message.vpcConnectorEgressSettings = object.vpcConnectorEgressSettings; + break; + } + break; case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": case 0: message.vpcConnectorEgressSettings = 0; @@ -19099,6 +19219,12 @@ break; } switch (object.ingressSettings) { + default: + if (typeof object.ingressSettings === "number") { + message.ingressSettings = object.ingressSettings; + break; + } + break; case "INGRESS_SETTINGS_UNSPECIFIED": case 0: message.ingressSettings = 0; @@ -19195,9 +19321,9 @@ if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) object.vpcConnector = message.vpcConnector; if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) - object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] === undefined ? message.vpcConnectorEgressSettings : $root.google.cloud.functions.v2alpha.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) - object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2alpha.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2alpha.ServiceConfig.IngressSettings[message.ingressSettings] === undefined ? message.ingressSettings : $root.google.cloud.functions.v2alpha.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; if (message.uri != null && message.hasOwnProperty("uri")) object.uri = message.uri; if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) @@ -20393,6 +20519,12 @@ if (object.serviceAccountEmail != null) message.serviceAccountEmail = String(object.serviceAccountEmail); switch (object.retryPolicy) { + default: + if (typeof object.retryPolicy === "number") { + message.retryPolicy = object.retryPolicy; + break; + } + break; case "RETRY_POLICY_UNSPECIFIED": case 0: message.retryPolicy = 0; @@ -20451,7 +20583,7 @@ if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) object.serviceAccountEmail = message.serviceAccountEmail; if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) - object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2alpha.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; + object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2alpha.EventTrigger.RetryPolicy[message.retryPolicy] === undefined ? message.retryPolicy : $root.google.cloud.functions.v2alpha.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; if (message.channel != null && message.hasOwnProperty("channel")) object.channel = message.channel; return object; @@ -23773,6 +23905,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.stage) { + default: + if (typeof object.stage === "number") { + message.stage = object.stage; + break; + } + break; case "RUNTIME_STAGE_UNSPECIFIED": case 0: message.stage = 0; @@ -23810,6 +23948,12 @@ message.warnings[i] = String(object.warnings[i]); } switch (object.environment) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; case "ENVIRONMENT_UNSPECIFIED": case 0: message.environment = 0; @@ -23850,14 +23994,14 @@ if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.stage != null && message.hasOwnProperty("stage")) - object.stage = options.enums === String ? $root.google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; + object.stage = options.enums === String ? $root.google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage[message.stage] === undefined ? message.stage : $root.google.cloud.functions.v2alpha.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; if (message.warnings && message.warnings.length) { object.warnings = []; for (var j = 0; j < message.warnings.length; ++j) object.warnings[j] = message.warnings[j]; } if (message.environment != null && message.hasOwnProperty("environment")) - object.environment = options.enums === String ? $root.google.cloud.functions.v2alpha.Environment[message.environment] : message.environment; + object.environment = options.enums === String ? $root.google.cloud.functions.v2alpha.Environment[message.environment] === undefined ? message.environment : $root.google.cloud.functions.v2alpha.Environment[message.environment] : message.environment; if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; return object; @@ -24611,6 +24755,12 @@ return object; var message = new $root.google.cloud.functions.v2alpha.Stage(); switch (object.name) { + default: + if (typeof object.name === "number") { + message.name = object.name; + break; + } + break; case "NAME_UNSPECIFIED": case 0: message.name = 0; @@ -24643,6 +24793,12 @@ if (object.message != null) message.message = String(object.message); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -24700,11 +24856,11 @@ object.resourceUri = ""; } if (message.name != null && message.hasOwnProperty("name")) - object.name = options.enums === String ? $root.google.cloud.functions.v2alpha.Stage.Name[message.name] : message.name; + object.name = options.enums === String ? $root.google.cloud.functions.v2alpha.Stage.Name[message.name] === undefined ? message.name : $root.google.cloud.functions.v2alpha.Stage.Name[message.name] : message.name; if (message.message != null && message.hasOwnProperty("message")) object.message = message.message; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.functions.v2alpha.Stage.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.functions.v2alpha.Stage.State[message.state] === undefined ? message.state : $root.google.cloud.functions.v2alpha.Stage.State[message.state] : message.state; if (message.resource != null && message.hasOwnProperty("resource")) object.resource = message.resource; if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) @@ -25488,6 +25644,12 @@ if (object.name != null) message.name = String(object.name); switch (object.environment) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; case "ENVIRONMENT_UNSPECIFIED": case 0: message.environment = 0; @@ -25519,6 +25681,12 @@ message.eventTrigger = $root.google.cloud.functions.v2beta.EventTrigger.fromObject(object.eventTrigger); } switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -25607,7 +25775,7 @@ if (message.eventTrigger != null && message.hasOwnProperty("eventTrigger")) object.eventTrigger = $root.google.cloud.functions.v2beta.EventTrigger.toObject(message.eventTrigger, options); if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.functions.v2beta.Function.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.functions.v2beta.Function.State[message.state] === undefined ? message.state : $root.google.cloud.functions.v2beta.Function.State[message.state] : message.state; if (message.updateTime != null && message.hasOwnProperty("updateTime")) object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); var keys2; @@ -25622,7 +25790,7 @@ object.stateMessages[j] = $root.google.cloud.functions.v2beta.StateMessage.toObject(message.stateMessages[j], options); } if (message.environment != null && message.hasOwnProperty("environment")) - object.environment = options.enums === String ? $root.google.cloud.functions.v2beta.Environment[message.environment] : message.environment; + object.environment = options.enums === String ? $root.google.cloud.functions.v2beta.Environment[message.environment] === undefined ? message.environment : $root.google.cloud.functions.v2beta.Environment[message.environment] : message.environment; return object; }; @@ -25870,6 +26038,12 @@ return object; var message = new $root.google.cloud.functions.v2beta.StateMessage(); switch (object.severity) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; case "SEVERITY_UNSPECIFIED": case 0: message.severity = 0; @@ -25913,7 +26087,7 @@ object.message = ""; } if (message.severity != null && message.hasOwnProperty("severity")) - object.severity = options.enums === String ? $root.google.cloud.functions.v2beta.StateMessage.Severity[message.severity] : message.severity; + object.severity = options.enums === String ? $root.google.cloud.functions.v2beta.StateMessage.Severity[message.severity] === undefined ? message.severity : $root.google.cloud.functions.v2beta.StateMessage.Severity[message.severity] : message.severity; if (message.type != null && message.hasOwnProperty("type")) object.type = message.type; if (message.message != null && message.hasOwnProperty("message")) @@ -27995,6 +28169,12 @@ if (object.vpcConnector != null) message.vpcConnector = String(object.vpcConnector); switch (object.vpcConnectorEgressSettings) { + default: + if (typeof object.vpcConnectorEgressSettings === "number") { + message.vpcConnectorEgressSettings = object.vpcConnectorEgressSettings; + break; + } + break; case "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED": case 0: message.vpcConnectorEgressSettings = 0; @@ -28009,6 +28189,12 @@ break; } switch (object.ingressSettings) { + default: + if (typeof object.ingressSettings === "number") { + message.ingressSettings = object.ingressSettings; + break; + } + break; case "INGRESS_SETTINGS_UNSPECIFIED": case 0: message.ingressSettings = 0; @@ -28105,9 +28291,9 @@ if (message.vpcConnector != null && message.hasOwnProperty("vpcConnector")) object.vpcConnector = message.vpcConnector; if (message.vpcConnectorEgressSettings != null && message.hasOwnProperty("vpcConnectorEgressSettings")) - object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; + object.vpcConnectorEgressSettings = options.enums === String ? $root.google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] === undefined ? message.vpcConnectorEgressSettings : $root.google.cloud.functions.v2beta.ServiceConfig.VpcConnectorEgressSettings[message.vpcConnectorEgressSettings] : message.vpcConnectorEgressSettings; if (message.ingressSettings != null && message.hasOwnProperty("ingressSettings")) - object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2beta.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; + object.ingressSettings = options.enums === String ? $root.google.cloud.functions.v2beta.ServiceConfig.IngressSettings[message.ingressSettings] === undefined ? message.ingressSettings : $root.google.cloud.functions.v2beta.ServiceConfig.IngressSettings[message.ingressSettings] : message.ingressSettings; if (message.uri != null && message.hasOwnProperty("uri")) object.uri = message.uri; if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) @@ -29303,6 +29489,12 @@ if (object.serviceAccountEmail != null) message.serviceAccountEmail = String(object.serviceAccountEmail); switch (object.retryPolicy) { + default: + if (typeof object.retryPolicy === "number") { + message.retryPolicy = object.retryPolicy; + break; + } + break; case "RETRY_POLICY_UNSPECIFIED": case 0: message.retryPolicy = 0; @@ -29361,7 +29553,7 @@ if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) object.serviceAccountEmail = message.serviceAccountEmail; if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) - object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2beta.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; + object.retryPolicy = options.enums === String ? $root.google.cloud.functions.v2beta.EventTrigger.RetryPolicy[message.retryPolicy] === undefined ? message.retryPolicy : $root.google.cloud.functions.v2beta.EventTrigger.RetryPolicy[message.retryPolicy] : message.retryPolicy; if (message.channel != null && message.hasOwnProperty("channel")) object.channel = message.channel; return object; @@ -32683,6 +32875,12 @@ if (object.displayName != null) message.displayName = String(object.displayName); switch (object.stage) { + default: + if (typeof object.stage === "number") { + message.stage = object.stage; + break; + } + break; case "RUNTIME_STAGE_UNSPECIFIED": case 0: message.stage = 0; @@ -32720,6 +32918,12 @@ message.warnings[i] = String(object.warnings[i]); } switch (object.environment) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; case "ENVIRONMENT_UNSPECIFIED": case 0: message.environment = 0; @@ -32760,14 +32964,14 @@ if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.stage != null && message.hasOwnProperty("stage")) - object.stage = options.enums === String ? $root.google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; + object.stage = options.enums === String ? $root.google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage[message.stage] === undefined ? message.stage : $root.google.cloud.functions.v2beta.ListRuntimesResponse.RuntimeStage[message.stage] : message.stage; if (message.warnings && message.warnings.length) { object.warnings = []; for (var j = 0; j < message.warnings.length; ++j) object.warnings[j] = message.warnings[j]; } if (message.environment != null && message.hasOwnProperty("environment")) - object.environment = options.enums === String ? $root.google.cloud.functions.v2beta.Environment[message.environment] : message.environment; + object.environment = options.enums === String ? $root.google.cloud.functions.v2beta.Environment[message.environment] === undefined ? message.environment : $root.google.cloud.functions.v2beta.Environment[message.environment] : message.environment; if (message.displayName != null && message.hasOwnProperty("displayName")) object.displayName = message.displayName; return object; @@ -33521,6 +33725,12 @@ return object; var message = new $root.google.cloud.functions.v2beta.Stage(); switch (object.name) { + default: + if (typeof object.name === "number") { + message.name = object.name; + break; + } + break; case "NAME_UNSPECIFIED": case 0: message.name = 0; @@ -33553,6 +33763,12 @@ if (object.message != null) message.message = String(object.message); switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; case "STATE_UNSPECIFIED": case 0: message.state = 0; @@ -33610,11 +33826,11 @@ object.resourceUri = ""; } if (message.name != null && message.hasOwnProperty("name")) - object.name = options.enums === String ? $root.google.cloud.functions.v2beta.Stage.Name[message.name] : message.name; + object.name = options.enums === String ? $root.google.cloud.functions.v2beta.Stage.Name[message.name] === undefined ? message.name : $root.google.cloud.functions.v2beta.Stage.Name[message.name] : message.name; if (message.message != null && message.hasOwnProperty("message")) object.message = message.message; if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.functions.v2beta.Stage.State[message.state] : message.state; + object.state = options.enums === String ? $root.google.cloud.functions.v2beta.Stage.State[message.state] === undefined ? message.state : $root.google.cloud.functions.v2beta.Stage.State[message.state] : message.state; if (message.resource != null && message.hasOwnProperty("resource")) object.resource = message.resource; if (message.resourceUri != null && message.hasOwnProperty("resourceUri")) @@ -35009,6 +35225,12 @@ if (object.nameField != null) message.nameField = String(object.nameField); switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; case "HISTORY_UNSPECIFIED": case 0: message.history = 0; @@ -35033,6 +35255,10 @@ for (var i = 0; i < object.style.length; ++i) switch (object.style[i]) { default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } case "STYLE_UNSPECIFIED": case 0: message.style[i] = 0; @@ -35080,7 +35306,7 @@ if (message.nameField != null && message.hasOwnProperty("nameField")) object.nameField = message.nameField; if (message.history != null && message.hasOwnProperty("history")) - object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; if (message.plural != null && message.hasOwnProperty("plural")) object.plural = message.plural; if (message.singular != null && message.hasOwnProperty("singular")) @@ -35088,7 +35314,7 @@ if (message.style && message.style.length) { object.style = []; for (var j = 0; j < message.style.length; ++j) - object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; } return object; }; @@ -37899,6 +38125,12 @@ if (object.number != null) message.number = object.number | 0; switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; case "LABEL_OPTIONAL": case 1: message.label = 1; @@ -37913,6 +38145,12 @@ break; } switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_DOUBLE": case 1: message.type = 1; @@ -38039,9 +38277,9 @@ if (message.number != null && message.hasOwnProperty("number")) object.number = message.number; if (message.label != null && message.hasOwnProperty("label")) - object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; if (message.typeName != null && message.hasOwnProperty("typeName")) object.typeName = message.typeName; if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) @@ -40388,6 +40626,12 @@ if (object.javaStringCheckUtf8 != null) message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; case "SPEED": case 1: message.optimizeFor = 1; @@ -40496,7 +40740,7 @@ if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) object.javaOuterClassname = message.javaOuterClassname; if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) object.javaMultipleFiles = message.javaMultipleFiles; if (message.goPackage != null && message.hasOwnProperty("goPackage")) @@ -41298,6 +41542,12 @@ return object; var message = new $root.google.protobuf.FieldOptions(); switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; case "STRING": case 0: message.ctype = 0; @@ -41314,6 +41564,12 @@ if (object.packed != null) message.packed = Boolean(object.packed); switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; case "JS_NORMAL": case 0: message.jstype = 0; @@ -41352,6 +41608,10 @@ for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) switch (object[".google.api.fieldBehavior"][i]) { default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } case "FIELD_BEHAVIOR_UNSPECIFIED": case 0: message[".google.api.fieldBehavior"][i] = 0; @@ -41422,7 +41682,7 @@ object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) - object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; if (message.packed != null && message.hasOwnProperty("packed")) object.packed = message.packed; if (message.deprecated != null && message.hasOwnProperty("deprecated")) @@ -41430,7 +41690,7 @@ if (message.lazy != null && message.hasOwnProperty("lazy")) object.lazy = message.lazy; if (message.jstype != null && message.hasOwnProperty("jstype")) - object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; if (message.weak != null && message.hasOwnProperty("weak")) object.weak = message.weak; if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) @@ -41443,7 +41703,7 @@ if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { object[".google.api.fieldBehavior"] = []; for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) - object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; } if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); @@ -42820,6 +43080,12 @@ if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); switch (object.idempotencyLevel) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; case "IDEMPOTENCY_UNKNOWN": case 0: message.idempotencyLevel = 0; @@ -42889,7 +43155,7 @@ if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -44644,6 +44910,12 @@ if (object.end != null) message.end = object.end | 0; switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; case "NONE": case 0: message.semantic = 0; @@ -44693,7 +44965,7 @@ if (message.end != null && message.hasOwnProperty("end")) object.end = message.end; if (message.semantic != null && message.hasOwnProperty("semantic")) - object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; return object; }; @@ -48198,6 +48470,12 @@ return object; var message = new $root.google.iam.v1.AuditLogConfig(); switch (object.logType) { + default: + if (typeof object.logType === "number") { + message.logType = object.logType; + break; + } + break; case "LOG_TYPE_UNSPECIFIED": case 0: message.logType = 0; @@ -48243,7 +48521,7 @@ if (options.defaults) object.logType = options.enums === String ? "LOG_TYPE_UNSPECIFIED" : 0; if (message.logType != null && message.hasOwnProperty("logType")) - object.logType = options.enums === String ? $root.google.iam.v1.AuditLogConfig.LogType[message.logType] : message.logType; + object.logType = options.enums === String ? $root.google.iam.v1.AuditLogConfig.LogType[message.logType] === undefined ? message.logType : $root.google.iam.v1.AuditLogConfig.LogType[message.logType] : message.logType; if (message.exemptedMembers && message.exemptedMembers.length) { object.exemptedMembers = []; for (var j = 0; j < message.exemptedMembers.length; ++j) @@ -48780,6 +49058,12 @@ return object; var message = new $root.google.iam.v1.BindingDelta(); switch (object.action) { + default: + if (typeof object.action === "number") { + message.action = object.action; + break; + } + break; case "ACTION_UNSPECIFIED": case 0: message.action = 0; @@ -48825,7 +49109,7 @@ object.condition = null; } if (message.action != null && message.hasOwnProperty("action")) - object.action = options.enums === String ? $root.google.iam.v1.BindingDelta.Action[message.action] : message.action; + object.action = options.enums === String ? $root.google.iam.v1.BindingDelta.Action[message.action] === undefined ? message.action : $root.google.iam.v1.BindingDelta.Action[message.action] : message.action; if (message.role != null && message.hasOwnProperty("role")) object.role = message.role; if (message.member != null && message.hasOwnProperty("member")) @@ -49090,6 +49374,12 @@ return object; var message = new $root.google.iam.v1.AuditConfigDelta(); switch (object.action) { + default: + if (typeof object.action === "number") { + message.action = object.action; + break; + } + break; case "ACTION_UNSPECIFIED": case 0: message.action = 0; @@ -49132,7 +49422,7 @@ object.logType = ""; } if (message.action != null && message.hasOwnProperty("action")) - object.action = options.enums === String ? $root.google.iam.v1.AuditConfigDelta.Action[message.action] : message.action; + object.action = options.enums === String ? $root.google.iam.v1.AuditConfigDelta.Action[message.action] === undefined ? message.action : $root.google.iam.v1.AuditConfigDelta.Action[message.action] : message.action; if (message.service != null && message.hasOwnProperty("service")) object.service = message.service; if (message.exemptedMember != null && message.hasOwnProperty("exemptedMember")) From 6b024d87d98f119c8430dfab23088de40c9b4860 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 11 Nov 2022 01:56:16 +0000 Subject: [PATCH 123/123] chore(main): release 2.2.3 (#203) :robot: I have created a release *beep* *boop* --- ## [2.2.3](https://togithub.com/googleapis/nodejs-functions/compare/v2.2.2...v2.2.3) (2022-11-11) ### Bug Fixes * **deps:** Use google-gax v3.5.2 ([#201](https://togithub.com/googleapis/nodejs-functions/issues/201)) ([727c86a](https://togithub.com/googleapis/nodejs-functions/commit/727c86a475f3405a86259e9ff1f2946e09ae81d3)) * Regenerated protos JS and TS definitions ([#205](https://togithub.com/googleapis/nodejs-functions/issues/205)) ([c2a42c6](https://togithub.com/googleapis/nodejs-functions/commit/c2a42c6eb29eea880d6c15ee85dc7a8b84f65eb9)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- packages/google-cloud-functions/CHANGELOG.md | 8 ++++++++ packages/google-cloud-functions/package.json | 2 +- .../v1/snippet_metadata.google.cloud.functions.v1.json | 2 +- .../v2/snippet_metadata.google.cloud.functions.v2.json | 2 +- .../snippet_metadata.google.cloud.functions.v2alpha.json | 2 +- .../snippet_metadata.google.cloud.functions.v2beta.json | 2 +- packages/google-cloud-functions/samples/package.json | 2 +- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md index 38f635d101e..4e3c3278e64 100644 --- a/packages/google-cloud-functions/CHANGELOG.md +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [2.2.3](https://github.com/googleapis/nodejs-functions/compare/v2.2.2...v2.2.3) (2022-11-11) + + +### Bug Fixes + +* **deps:** Use google-gax v3.5.2 ([#201](https://github.com/googleapis/nodejs-functions/issues/201)) ([727c86a](https://github.com/googleapis/nodejs-functions/commit/727c86a475f3405a86259e9ff1f2946e09ae81d3)) +* Regenerated protos JS and TS definitions ([#205](https://github.com/googleapis/nodejs-functions/issues/205)) ([c2a42c6](https://github.com/googleapis/nodejs-functions/commit/c2a42c6eb29eea880d6c15ee85dc7a8b84f65eb9)) + ## [2.2.2](https://github.com/googleapis/nodejs-functions/compare/v2.2.1...v2.2.2) (2022-09-21) diff --git a/packages/google-cloud-functions/package.json b/packages/google-cloud-functions/package.json index b2d5fa15e80..9eed76b58c1 100644 --- a/packages/google-cloud-functions/package.json +++ b/packages/google-cloud-functions/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/functions", - "version": "2.2.2", + "version": "2.2.3", "description": "Functions client for Node.js", "repository": "googleapis/nodejs-functions", "license": "Apache-2.0", diff --git a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json index 8c0207a9b7c..def50ce79c4 100644 --- a/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.2", + "version": "2.2.3", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json index 9bffaee6d18..24267274d1f 100644 --- a/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json +++ b/packages/google-cloud-functions/samples/generated/v2/snippet_metadata.google.cloud.functions.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.2", + "version": "2.2.3", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json index 6cc44f4dfc7..33cd80e6595 100644 --- a/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json +++ b/packages/google-cloud-functions/samples/generated/v2alpha/snippet_metadata.google.cloud.functions.v2alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.2", + "version": "2.2.3", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json index 352866429b7..aecec79d2c1 100644 --- a/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json +++ b/packages/google-cloud-functions/samples/generated/v2beta/snippet_metadata.google.cloud.functions.v2beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-functions", - "version": "2.2.2", + "version": "2.2.3", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-functions/samples/package.json b/packages/google-cloud-functions/samples/package.json index 4c760c41520..b652cba0d4e 100644 --- a/packages/google-cloud-functions/samples/package.json +++ b/packages/google-cloud-functions/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/functions": "^2.2.2" + "@google-cloud/functions": "^2.2.3" }, "devDependencies": { "c8": "^7.1.0",