diff --git a/packages/google-cloud-functions/.eslintignore b/packages/google-cloud-functions/.eslintignore new file mode 100644 index 00000000000..ea5b04aebe6 --- /dev/null +++ b/packages/google-cloud-functions/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ +samples/generated/ 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/.github/.OwlBot.yaml b/packages/google-cloud-functions/.github/.OwlBot.yaml new file mode 100644 index 00000000000..1b49af14a32 --- /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/cloud-devrel-public-resources/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/.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..9ded0c9e61c --- /dev/null +++ b/packages/google-cloud-functions/.jsdoc.js @@ -0,0 +1,55 @@ +// 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'; + +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 2022 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..0b600509bed --- /dev/null +++ b/packages/google-cloud-functions/.mocharc.js @@ -0,0 +1,29 @@ +// 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, + "recursive": true +} +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/.repo-metadata.json b/packages/google-cloud-functions/.repo-metadata.json new file mode 100644 index 00000000000..489554162fa --- /dev/null +++ b/packages/google-cloud-functions/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "issue_tracker": "", + "distribution_name": "@google-cloud/functions", + "product_documentation": "https://cloud.google.com/functions", + "api_id": "cloudfunctions.googleapis.com", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/functions/latest", + "repo": "googleapis/nodejs-functions", + "release_level": "stable", + "requires_billing": false, + "name_pretty": "Google Cloud Functions", + "name": "nodejs-functions", + "codeowner_team": "@googleapis/aap-dpes", + "default_version": "v1", + "language": "nodejs", + "api_shortname": "cloudfunctions", + "library_type": "GAPIC_AUTO" +} diff --git a/packages/google-cloud-functions/CHANGELOG.md b/packages/google-cloud-functions/CHANGELOG.md new file mode 100644 index 00000000000..4e3c3278e64 --- /dev/null +++ b/packages/google-cloud-functions/CHANGELOG.md @@ -0,0 +1,176 @@ +# 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### ⚠ 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### ⚠ 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)) 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..2add2547a81 --- /dev/null +++ b/packages/google-cloud-functions/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +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 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, 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/CONTRIBUTING.md b/packages/google-cloud-functions/CONTRIBUTING.md new file mode 100644 index 00000000000..f7c51fb1b40 --- /dev/null +++ b/packages/google-cloud-functions/CONTRIBUTING.md @@ -0,0 +1,75 @@ +# 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.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). + +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/) 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]. + +1. Install dependencies: + + npm install + +1. Run the tests: + + # Run unit tests. + npm test + + # Run sample integration tests. + npm run samples-test + + # Run all system tests. + npm run system-test + +1. Lint (and maybe fix) any changes: + + 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/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..1c9227b291e --- /dev/null +++ b/packages/google-cloud-functions/README.md @@ -0,0 +1,160 @@ +[//]: # "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 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) + + + + +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/main/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) + +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) + * [Using the client library](#using-the-client-library) +* [Samples](#samples) +* [Versioning](#versioning) +* [Contributing](#contributing) +* [License](#license) + +## Quickstart + +### 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. + +### Installing the client library + +```bash +npm install @google-cloud/functions +``` + + +### Using the client library + +```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(); + +// project = 'my-project/*/locations/*' // Get the functions for a project. +async function listFunctions() { + const [functions] = await client.listFunctions({ + parent: `projects/${projectId}/locations/-`, + }); + console.info(functions); +} +listFunctions(); + +``` + + + +## Samples + +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/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) | + + + +The [Google 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. +If you are using an end-of-life version of Node.js, we recommend that you update +as soon as possible to an actively supported LTS version. + +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: + +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. + +Client libraries targeting some end-of-life versions of Node.js are available, and +can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. +For example, `npm install @google-cloud/functions@legacy-8` installs client libraries +for versions compatible with Node.js 8. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + + + +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 **stable** libraries +are addressed with the highest 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/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 templates in +[directory](https://github.com/googleapis/synthtool). + +## License + +Apache Version 2.0 + +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 +[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 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 00000000000..1c06c444214 Binary files /dev/null and b/packages/google-cloud-functions/__pycache__/synth.cpython-37.pyc differ diff --git a/packages/google-cloud-functions/linkinator.config.json b/packages/google-cloud-functions/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/packages/google-cloud-functions/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/packages/google-cloud-functions/owlbot.py b/packages/google-cloud-functions/owlbot.py new file mode 100644 index 00000000000..f75b4adadd5 --- /dev/null +++ b/packages/google-cloud-functions/owlbot.py @@ -0,0 +1,19 @@ +# 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 + +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 new file mode 100644 index 00000000000..9eed76b58c1 --- /dev/null +++ b/packages/google-cloud-functions/package.json @@ -0,0 +1,66 @@ +{ + "name": "@google-cloud/functions", + "version": "2.2.3", + "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", + "prelint": "cd samples; npm link ../; npm i", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^18.0.0", + "@types/sinon": "^10.0.0", + "c8": "^7.2.1", + "gts": "^3.1.0", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.0", + "jsdoc-region-tag": "^2.0.0", + "linkinator": "^4.0.0", + "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": "^4.6.4", + "webpack": "^5.0.0", + "webpack-cli": "^4.0.0" + }, + "engines": { + "node": ">=12.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..7592f3bed90 --- /dev/null +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/functions.proto @@ -0,0 +1,855 @@ +// 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.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"; +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 { + 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; + } + + // 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; + + // 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 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; + } + + // 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](https://cloud.google.com/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; + + // 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 + // 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. + // + // 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 + // `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; + + // 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 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) - + // 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" + }]; + + // 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 +// 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 { + // 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 +// 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; + } +} + +// 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. +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 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. 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 + // 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. The list of fields in `CloudFunction` that have to be updated. + 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" + } + ]; +} + +// 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; + + // 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. +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..9d634e782f7 --- /dev/null +++ b/packages/google-cloud-functions/protos/google/cloud/functions/v1/operations.proto @@ -0,0 +1,73 @@ +// 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.v1; + +import "google/protobuf/any.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 = "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; + + // 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/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/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 new file mode 100644 index 00000000000..008a48a70a2 --- /dev/null +++ b/packages/google-cloud-functions/protos/protos.d.ts @@ -0,0 +1,20527 @@ +// 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. + +import type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); +/** 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 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); + + /** 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 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); + + /** CloudFunction dockerRegistry */ + dockerRegistry?: (google.cloud.functions.v1.CloudFunction.DockerRegistry|keyof typeof google.cloud.functions.v1.CloudFunction.DockerRegistry|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|null); + + /** CloudFunction sourceRepository. */ + public sourceRepository?: (google.cloud.functions.v1.ISourceRepository|null); + + /** CloudFunction sourceUploadUrl. */ + public sourceUploadUrl?: (string|null); + + /** 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 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; + + /** 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 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 dockerRegistry. */ + public dockerRegistry: (google.cloud.functions.v1.CloudFunction.DockerRegistry|keyof typeof google.cloud.functions.v1.CloudFunction.DockerRegistry); + + /** 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 }; + + /** + * 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 { + + /** 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 + } + + /** DockerRegistry enum. */ + enum DockerRegistry { + DOCKER_REGISTRY_UNSPECIFIED = 0, + CONTAINER_REGISTRY = 1, + ARTIFACT_REGISTRY = 2 + } + } + + /** 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 }; + + /** + * 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. */ + interface IHttpsTrigger { + + /** 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. */ + 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; + + /** 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 + * @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 }; + + /** + * 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 { + + /** SecurityLevel enum. */ + enum SecurityLevel { + SECURITY_LEVEL_UNSPECIFIED = 0, + SECURE_ALWAYS = 1, + SECURE_OPTIONAL = 2 + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + interface IGenerateUploadUrlRequest { + + /** GenerateUploadUrlRequest parent */ + parent?: (string|null); + + /** GenerateUploadUrlRequest kmsKeyName */ + kmsKeyName?: (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; + + /** GenerateUploadUrlRequest kmsKeyName. */ + public kmsKeyName: 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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); + + /** OperationMetadataV1 sourceToken */ + sourceToken?: (string|null); + + /** OperationMetadataV1 buildName */ + buildName?: (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; + + /** OperationMetadataV1 sourceToken. */ + public sourceToken: string; + + /** OperationMetadataV1 buildName. */ + public buildName: 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 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 }; + + /** + * 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. */ + 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|null); + + /** HttpRule put. */ + public put?: (string|null); + + /** HttpRule post. */ + public post?: (string|null); + + /** HttpRule delete. */ + public delete?: (string|null); + + /** HttpRule patch. */ + public patch?: (string|null); + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 + } + + /** 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); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|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; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * 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 }; + + /** + * 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 { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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); + + /** FileDescriptorProto edition */ + edition?: (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; + + /** FileDescriptorProto edition. */ + public edition: 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 unverifiedLazy */ + unverifiedLazy?: (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 unverifiedLazy. */ + public unverifiedLazy: 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|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; + + /** 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 + * @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 }; + + /** + * 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; + } + + namespace Annotation { + + /** Semantic enum. */ + enum Semantic { + NONE = 0, + SET = 1, + ALIAS = 2 + } + } + } + + /** 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 }; + + /** + * 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 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 }; + + /** + * 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 { + + /** + * 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 }; + + /** + * 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. */ + 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 }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** 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 }; + + /** + * 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; + } + } + + /** 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); + + /** SetIamPolicyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|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); + + /** SetIamPolicyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + interface IPolicy { + + /** Policy version */ + version?: (number|null); + + /** Policy bindings */ + bindings?: (google.iam.v1.IBinding[]|null); + + /** Policy auditConfigs */ + auditConfigs?: (google.iam.v1.IAuditConfig[]|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 auditConfigs. */ + public auditConfigs: google.iam.v1.IAuditConfig[]; + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 new file mode 100644 index 00000000000..c9d5fbb11b3 --- /dev/null +++ b/packages/google-cloud-functions/protos/protos.js @@ -0,0 +1,52198 @@ +// 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. + +/*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("google-gax/build/src/protobuf").protobufMinimal); + +})(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 {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 + * @property {google.cloud.functions.v1.CloudFunction.DockerRegistry|null} [dockerRegistry] CloudFunction dockerRegistry + */ + + /** + * 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 = {}; + 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) + 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|null|undefined} sourceArchiveUrl + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.sourceArchiveUrl = null; + + /** + * 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|null|undefined} sourceUploadUrl + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.sourceUploadUrl = null; + + /** + * 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 buildEnvironmentVariables. + * @member {Object.} buildEnvironmentVariables + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.buildEnvironmentVariables = $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 minInstances. + * @member {number} minInstances + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + CloudFunction.prototype.minInstances = 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 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 + * @memberof google.cloud.functions.v1.CloudFunction + * @instance + */ + 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 = ""; + + /** + * 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; + + /** + * 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.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); + if (message.dockerRegistry != null && Object.hasOwnProperty.call(message, "dockerRegistry")) + writer.uint32(/* id 35, wireType 0 =*/280).int32(message.dockerRegistry); + 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 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; + } + 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.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"; + 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.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"; + 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; + }; + + /** + * 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) { + default: + if (typeof object.status === "number") { + message.status = object.status; + break; + } + break; + 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.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) { + default: + if (typeof object.vpcConnectorEgressSettings === "number") { + message.vpcConnectorEgressSettings = object.vpcConnectorEgressSettings; + break; + } + break; + 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) { + default: + if (typeof object.ingressSettings === "number") { + message.ingressSettings = object.ingressSettings; + break; + } + break; + 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.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); + switch (object.dockerRegistry) { + default: + if (typeof object.dockerRegistry === "number") { + message.dockerRegistry = object.dockerRegistry; + break; + } + break; + 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; + }; + + /** + * 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.arrays || options.defaults) { + object.secretEnvironmentVariables = []; + object.secretVolumes = []; + } + if (options.objects || options.defaults) { + object.labels = {}; + object.environmentVariables = {}; + object.buildEnvironmentVariables = {}; + } + 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.kmsKeyName = ""; + object.buildWorkerPool = ""; + object.buildId = ""; + object.sourceToken = ""; + 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; + 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] === 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")) + 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] === 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] === 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")) + 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; + if (message.dockerRegistry != null && message.hasOwnProperty("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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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; + })(); + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + v1.HttpsTrigger = (function() { + + /** + * Properties of a HttpsTrigger. + * @memberof google.cloud.functions.v1 + * @interface IHttpsTrigger + * @property {string|null} [url] HttpsTrigger url + * @property {google.cloud.functions.v1.HttpsTrigger.SecurityLevel|null} [securityLevel] HttpsTrigger securityLevel + */ + + /** + * 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 = ""; + + /** + * 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 + * @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); + if (message.securityLevel != null && Object.hasOwnProperty.call(message, "securityLevel")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.securityLevel); + 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; + } + case 2: { + message.securityLevel = reader.int32(); + 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"; + 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; + }; + + /** + * 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); + switch (object.securityLevel) { + default: + if (typeof object.securityLevel === "number") { + message.securityLevel = object.securityLevel; + break; + } + break; + 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; + }; + + /** + * 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 = ""; + 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] === undefined ? message.securityLevel : $root.google.cloud.functions.v1.HttpsTrigger.SecurityLevel[message.securityLevel] : message.securityLevel; + 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); + }; + + /** + * 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 + * @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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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() { + + /** + * 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.SecretEnvVar + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.SecretEnvVar} SecretEnvVar + */ + SecretEnvVar.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.SecretEnvVar) + return object; + 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 a SecretEnvVar message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.SecretEnvVar + * @static + * @param {google.cloud.functions.v1.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.v1.SecretEnvVar + * @instance + * @returns {Object.} JSON object + */ + SecretEnvVar.prototype.toJSON = function toJSON() { + 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; + })(); + + v1.SecretVolume = (function() { + + /** + * Properties of a SecretVolume. + * @memberof google.cloud.functions.v1 + * @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.v1 + * @classdesc Represents a SecretVolume. + * @implements ISecretVolume + * @constructor + * @param {google.cloud.functions.v1.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.v1.SecretVolume + * @instance + */ + SecretVolume.prototype.mountPath = ""; + + /** + * SecretVolume projectId. + * @member {string} projectId + * @memberof google.cloud.functions.v1.SecretVolume + * @instance + */ + SecretVolume.prototype.projectId = ""; + + /** + * SecretVolume secret. + * @member {string} secret + * @memberof google.cloud.functions.v1.SecretVolume + * @instance + */ + SecretVolume.prototype.secret = ""; + + /** + * 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.SecretVolume + * @static + * @param {google.cloud.functions.v1.ISecretVolume=} [properties] Properties to set + * @returns {google.cloud.functions.v1.SecretVolume} SecretVolume instance + */ + SecretVolume.create = function create(properties) { + return new SecretVolume(properties); + }; + + /** + * Encodes the specified SecretVolume message. Does not implicitly {@link google.cloud.functions.v1.SecretVolume.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.SecretVolume + * @static + * @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 + */ + 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.v1.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.v1.SecretVolume.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.SecretVolume + * @static + * @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 + */ + 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.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.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.v1.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.v1.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.v1.SecretVolume + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1.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.v1.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.v1.SecretVolume + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.SecretVolume} SecretVolume + */ + SecretVolume.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.SecretVolume) + return object; + 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 SecretVolume message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.SecretVolume + * @static + * @param {google.cloud.functions.v1.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.v1.SecretVolume.SecretVersion.toObject(message.versions[j], options); + } + return object; + }; + + /** + * Converts this SecretVolume to JSON. + * @function toJSON + * @memberof google.cloud.functions.v1.SecretVolume + * @instance + * @returns {Object.} JSON object + */ + SecretVolume.prototype.toJSON = function toJSON() { + 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() { + + /** + * 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 SecretVersion. + * @memberof google.cloud.functions.v1.SecretVolume + * @classdesc Represents a SecretVersion. + * @implements ISecretVersion + * @constructor + * @param {google.cloud.functions.v1.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.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.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v1.SecretVolume.ISecretVersion=} [properties] Properties to set + * @returns {google.cloud.functions.v1.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.v1.SecretVolume.SecretVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion + * @static + * @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 + */ + 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.v1.SecretVolume.SecretVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion + * @static + * @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 + */ + 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.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.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.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; + } + } + return message; + }; + + /** + * Decodes a SecretVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1.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.v1.SecretVolume.SecretVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.functions.v1.SecretVolume.SecretVersion} SecretVersion + */ + SecretVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.functions.v1.SecretVolume.SecretVersion) + return object; + 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 SecretVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.functions.v1.SecretVolume.SecretVersion + * @static + * @param {google.cloud.functions.v1.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.v1.SecretVolume.SecretVersion + * @instance + * @returns {Object.} JSON object + */ + SecretVersion.prototype.toJSON = function toJSON() { + 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; + })(); + + return SecretVolume; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + v1.GenerateUploadUrlRequest = (function() { + + /** + * Properties of a GenerateUploadUrlRequest. + * @memberof google.cloud.functions.v1 + * @interface IGenerateUploadUrlRequest + * @property {string|null} [parent] GenerateUploadUrlRequest parent + * @property {string|null} [kmsKeyName] GenerateUploadUrlRequest kmsKeyName + */ + + /** + * 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 = ""; + + /** + * 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 + * @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); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kmsKeyName); + 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; + } + case 2: { + message.kmsKeyName = 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"; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: 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); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + 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 = ""; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + /** + * 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 + * @property {string|null} [sourceToken] OperationMetadataV1 sourceToken + * @property {string|null} [buildName] OperationMetadataV1 buildName + */ + + /** + * 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 = ""; + + /** + * 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 + * @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); + 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; + }; + + /** + * 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; + } + case 7: { + message.sourceToken = reader.string(); + break; + } + case 8: { + message.buildName = 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"; + 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; + }; + + /** + * 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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + 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); + if (object.sourceToken != null) + message.sourceToken = String(object.sourceToken); + if (object.buildName != null) + message.buildName = String(object.buildName); + 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 = ""; + object.sourceToken = ""; + object.buildName = ""; + } + 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] === 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")) + 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; + if (message.sourceToken != null && message.hasOwnProperty("sourceToken")) + object.sourceToken = message.sourceToken; + if (message.buildName != null && message.hasOwnProperty("buildName")) + object.buildName = message.buildName; + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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; + 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] === undefined ? message.environment : $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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.vpcConnectorEgressSettings === "number") { + message.vpcConnectorEgressSettings = object.vpcConnectorEgressSettings; + break; + } + break; + 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) { + default: + if (typeof object.ingressSettings === "number") { + message.ingressSettings = object.ingressSettings; + break; + } + break; + 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] === 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.retryPolicy === "number") { + message.retryPolicy = object.retryPolicy; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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) { + default: + if (typeof object.stage === "number") { + message.stage = object.stage; + break; + } + break; + 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) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; + 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] === 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.name === "number") { + message.name = object.name; + break; + } + break; + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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] === 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")) + 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); + }; + + /** + * 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 + * @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() { + + /** + * 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) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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; + 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] === undefined ? message.environment : $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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.vpcConnectorEgressSettings === "number") { + message.vpcConnectorEgressSettings = object.vpcConnectorEgressSettings; + break; + } + break; + 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) { + default: + if (typeof object.ingressSettings === "number") { + message.ingressSettings = object.ingressSettings; + break; + } + break; + 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] === 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.retryPolicy === "number") { + message.retryPolicy = object.retryPolicy; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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) { + default: + if (typeof object.stage === "number") { + message.stage = object.stage; + break; + } + break; + 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) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; + 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] === 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.name === "number") { + message.name = object.name; + break; + } + break; + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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] === 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")) + 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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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; + 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] === undefined ? message.environment : $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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.vpcConnectorEgressSettings === "number") { + message.vpcConnectorEgressSettings = object.vpcConnectorEgressSettings; + break; + } + break; + 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) { + default: + if (typeof object.ingressSettings === "number") { + message.ingressSettings = object.ingressSettings; + break; + } + break; + 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] === 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.retryPolicy === "number") { + message.retryPolicy = object.retryPolicy; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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) { + default: + if (typeof object.stage === "number") { + message.stage = object.stage; + break; + } + break; + 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) { + default: + if (typeof object.environment === "number") { + message.environment = object.environment; + break; + } + break; + 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] === 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.name === "number") { + message.name = object.name; + break; + } + break; + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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] === 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")) + 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); + }; + + /** + * 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 + * @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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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|null|undefined} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = null; + + /** + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = null; + + /** + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = null; + + /** + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = null; + + /** + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = null; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + /** + * 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 + * @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); + 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; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + 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 + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * 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 = []; + this.style = []; + 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 = ""; + + /** + * 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 + * @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); + 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; + }; + + /** + * 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; + } + 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; + } + } + 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"; + 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; + }; + + /** + * 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) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; + 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); + 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: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + 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 = []; + object.style = []; + } + 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] === 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")) + 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]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + 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); + }; + + /** + * 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 + * @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; + })(); + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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 + * @property {string|null} [edition] FileDescriptorProto edition + */ + + /** + * 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 = ""; + + /** + * FileDescriptorProto edition. + * @member {string} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = ""; + + /** + * 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); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); + 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; + } + case 13: { + message.edition = 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"; + if (message.edition != null && message.hasOwnProperty("edition")) + if (!$util.isString(message.edition)) + return "edition: 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); + if (object.edition != null) + message.edition = String(object.edition); + 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 = ""; + object.edition = ""; + } + 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; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = message.edition; + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; + 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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + 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] === 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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} [unverifiedLazy] FieldOptions unverifiedLazy + * @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 unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = 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.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(); + 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 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()); + 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.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"; + 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: + case 6: + case 7: + 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) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; + 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) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; + 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.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); + 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: + 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; + 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; + case "UNORDERED_LIST": + 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) { + 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.unverifiedLazy = 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] === 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")) + 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] === 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")) + object.unverifiedLazy = message.unverifiedLazy; + 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]] === 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); + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; + 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] === 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) + 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); + }; + + /** + * 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 + * @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 >= 0) + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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 + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic + */ + + /** + * 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; + + /** + * 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 + * @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); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); + 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; + } + case 5: { + message.semantic = 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"; + 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; + }; + + /** + * 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; + switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; + 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; + }; + + /** + * 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; + object.semantic = options.enums === String ? "NONE" : 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; + if (message.semantic != null && message.hasOwnProperty("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; + }; + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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 >= 0) + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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 + * @property {google.protobuf.IFieldMask|null} [updateMask] SetIamPolicyRequest updateMask + */ + + /** + * 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; + + /** + * 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 + * @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(); + 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; + }; + + /** + * 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; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.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; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + 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); + } + 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; + }; + + /** + * 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; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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 {Array.|null} [auditConfigs] Policy auditConfigs + * @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 = []; + this.auditConfigs = []; + 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 auditConfigs. + * @member {Array.} auditConfigs + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.auditConfigs = $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(); + 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; + }; + + /** + * 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 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; + } + } + 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.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"; + 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.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 >= 0) + 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 = []; + object.auditConfigs = []; + } + 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); + } + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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) { + default: + if (typeof object.logType === "number") { + message.logType = object.logType; + break; + } + break; + 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] === 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) + 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.action === "number") { + message.action = object.action; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.action === "number") { + message.action = object.action; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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..96b51701a70 --- /dev/null +++ b/packages/google-cloud-functions/protos/protos.json @@ -0,0 +1,5535 @@ +{ + "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", + "(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": { + "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" + }, + "parsedOptions": [ + { + "(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" + }, + "parsedOptions": [ + { + "(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" + }, + "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", + "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" + }, + "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", + "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" + }, + "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", + "responseType": "CallFunctionResponse", + "options": { + "(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", + "responseType": "GenerateUploadUrlResponse", + "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", + "responseType": "GenerateDownloadUrlResponse", + "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", + "responseType": "google.iam.v1.Policy", + "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", + "responseType": "google.iam.v1.TestIamPermissionsResponse", + "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": "*" + } + } + ] + } + } + }, + "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 + }, + "buildEnvironmentVariables": { + "keyType": "string", + "type": "string", + "id": 28 + }, + "network": { + "type": "string", + "id": 18 + }, + "maxInstances": { + "type": "int32", + "id": 20 + }, + "minInstances": { + "type": "int32", + "id": 32 + }, + "vpcConnector": { + "type": "string", + "id": 22 + }, + "vpcConnectorEgressSettings": { + "type": "VpcConnectorEgressSettings", + "id": 23 + }, + "ingressSettings": { + "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" + } + }, + "dockerRegistry": { + "type": "DockerRegistry", + "id": 35 + } + }, + "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 + } + }, + "DockerRegistry": { + "values": { + "DOCKER_REGISTRY_UNSPECIFIED": 0, + "CONTAINER_REGISTRY": 1, + "ARTIFACT_REGISTRY": 2 + } + } + } + }, + "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" + } + }, + "securityLevel": { + "type": "SecurityLevel", + "id": 2 + } + }, + "nested": { + "SecurityLevel": { + "values": { + "SECURITY_LEVEL_UNSPECIFIED": 0, + "SECURE_ALWAYS": 1, + "SECURE_OPTIONAL": 2 + } + } + } + }, + "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": {} + } + } + }, + "CloudFunctionStatus": { + "values": { + "CLOUD_FUNCTION_STATUS_UNSPECIFIED": 0, + "ACTIVE": 1, + "OFFLINE": 2, + "DEPLOY_IN_PROGRESS": 3, + "DELETE_IN_PROGRESS": 4, + "UNKNOWN": 5 + } + }, + "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": { + "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" + } + } + } + }, + "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 + }, + "kmsKeyName": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + } + } + }, + "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 + }, + "sourceToken": { + "type": "string", + "id": 7 + }, + "buildName": { + "type": "string", + "id": 8 + } + } + } + } + }, + "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", + "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 + } + } + } + } + } + } + } + } + } + }, + "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, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 + } + }, + "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 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + } + } + }, + "protobuf": { + "options": { + "go_package": "google.golang.org/protobuf/types/descriptorpb", + "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 + }, + "edition": { + "type": "string", + "id": 13 + } + } + }, + "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": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], + [ + 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 + } + }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "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 + }, + "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": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Empty": { + "fields": {} + }, + "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": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:setIamPolicy", + "body": "*" + } + } + ] + }, + "GetIamPolicy": { + "requestType": "GetIamPolicyRequest", + "responseType": "Policy", + "options": { + "(google.api.http).post": "/v1/{resource=**}:getIamPolicy", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:getIamPolicy", + "body": "*" + } + } + ] + }, + "TestIamPermissions": { + "requestType": "TestIamPermissionsRequest", + "responseType": "TestIamPermissionsResponse", + "options": { + "(google.api.http).post": "/v1/{resource=**}:testIamPermissions", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:testIamPermissions", + "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" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + } + } + }, + "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 + }, + "auditConfigs": { + "rule": "repeated", + "type": "AuditConfig", + "id": 6 + }, + "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 + } + } + }, + "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": { + "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" + }, + "parsedOptions": [ + { + "(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" + }, + "parsedOptions": [ + { + "(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" + }, + "parsedOptions": [ + { + "(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" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=operations/**}:cancel", + "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/samples/README.md b/packages/google-cloud-functions/samples/README.md new file mode 100644 index 00000000000..9b4c892afb1 --- /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/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) + +__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://cloud.google.com/functions 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..c4cfc8faf0c --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.call_function.js @@ -0,0 +1,66 @@ +// 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, 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. + */ + /** + * 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..fd7ed9226db --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.create_function.js @@ -0,0 +1,68 @@ +// 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(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. + */ + /** + * 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..0c35da5b8c9 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.delete_function.js @@ -0,0 +1,62 @@ +// 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_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. + */ + /** + * 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..dc32b559d28 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_download_url.js @@ -0,0 +1,66 @@ +// 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() { + // [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. + */ + /** + * 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..707d9b510d8 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.generate_upload_url.js @@ -0,0 +1,79 @@ +// 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() { + // [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. + */ + /** + * The project and location in which the Google Cloud Storage signed URL + * 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; + + // 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..f713c5dc690 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_function.js @@ -0,0 +1,61 @@ +// 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_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. + */ + /** + * 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..7cc8933f8f1 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.get_iam_policy.js @@ -0,0 +1,67 @@ +// 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(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. + */ + /** + * 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`. + */ + // 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..e935eb973f3 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.list_functions.js @@ -0,0 +1,78 @@ +// 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() { + // [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. + */ + /** + * 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..be675c26943 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.set_iam_policy.js @@ -0,0 +1,77 @@ +// 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(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. + */ + /** + * 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 = {} + /** + * 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; + + // 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..68f45a6c059 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.test_iam_permissions.js @@ -0,0 +1,70 @@ +// 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(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. + */ + /** + * 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..6b21992ab74 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/cloud_functions_service.update_function.js @@ -0,0 +1,66 @@ +// 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_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. + */ + /** + * Required. New version of the function. + */ + // const function = {} + /** + * Required. The list of fields in `CloudFunction` that have to be updated. + */ + // 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/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..def50ce79c4 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v1/snippet_metadata.google.cloud.functions.v1.json @@ -0,0 +1,499 @@ +{ + "clientLibrary": { + "name": "nodejs-functions", + "version": "2.2.3", + "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": 70, + "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": 53, + "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": 60, + "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": 58, + "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": 54, + "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": 58, + "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": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateUploadUrl", + "fullName": "google.cloud.functions.v1.CloudFunctionsService.GenerateUploadUrl", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "kms_key_name", + "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": 58, + "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": 69, + "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" + } + } + } + }, + { + "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": 59, + "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": 62, + "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 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..c585666f560 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.create_function.js @@ -0,0 +1,75 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..63daecb7a1c --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.delete_function.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the 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..28ed683607c --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_download_url.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of 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..6704ec9d56a --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.generate_upload_url.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..b97bfeacc83 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.get_function.js @@ -0,0 +1,61 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the 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..59d5e346ffc --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.list_functions.js @@ -0,0 +1,90 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..e31bd464ca0 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.list_runtimes.js @@ -0,0 +1,67 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..fe8f3a121c8 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2/function_service.update_function.js @@ -0,0 +1,68 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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..24267274d1f --- /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.2.3", + "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": 53, + "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": 82, + "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": 67, + "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": 60, + "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": 54, + "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": 54, + "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": 54, + "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": 59, + "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/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..f2023fd5027 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.create_function.js @@ -0,0 +1,75 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..0e1d8fb0cd5 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.delete_function.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the 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..56d9473faa5 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_download_url.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of 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..b01f0882b43 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.generate_upload_url.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..f4a6264ecd1 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.get_function.js @@ -0,0 +1,61 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the 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..e110be8b387 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_functions.js @@ -0,0 +1,90 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..c25eb86f09b --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.list_runtimes.js @@ -0,0 +1,67 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..31be95a6d69 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2alpha/function_service.update_function.js @@ -0,0 +1,68 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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..33cd80e6595 --- /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.2.3", + "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": 53, + "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": 82, + "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": 67, + "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": 60, + "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": 54, + "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": 54, + "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": 54, + "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": 59, + "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..917ce9f815e --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.create_function.js @@ -0,0 +1,75 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..7a862b3e9f5 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.delete_function.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the 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..063bc6872f9 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_download_url.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of 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..fe3d0b49ed9 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.generate_upload_url.js @@ -0,0 +1,62 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..0f6dca9671f --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.get_function.js @@ -0,0 +1,61 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the 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..421a9f30785 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_functions.js @@ -0,0 +1,90 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..8103ee13c16 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.list_runtimes.js @@ -0,0 +1,67 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project 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..579bf7a25c1 --- /dev/null +++ b/packages/google-cloud-functions/samples/generated/v2beta/function_service.update_function.js @@ -0,0 +1,68 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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..aecec79d2c1 --- /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.2.3", + "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": 53, + "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": 82, + "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": 67, + "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": 60, + "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": 54, + "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": 54, + "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": 54, + "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": 59, + "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/samples/package.json b/packages/google-cloud-functions/samples/package.json new file mode 100644 index 00000000000..b652cba0d4e --- /dev/null +++ b/packages/google-cloud-functions/samples/package.json @@ -0,0 +1,23 @@ +{ + "name": "nodejs-cloud-functions", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=12.0.0" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "c8 mocha --timeout 600000 test/*.js" + }, + "dependencies": { + "@google-cloud/functions": "^2.2.3" + }, + "devDependencies": { + "c8": "^7.1.0", + "chai": "^4.2.0", + "mocha": "^8.0.0" + } +} diff --git a/packages/google-cloud-functions/samples/quickstart.js b/packages/google-cloud-functions/samples/quickstart.js new file mode 100644 index 00000000000..8c54dfec4e2 --- /dev/null +++ b/packages/google-cloud-functions/samples/quickstart.js @@ -0,0 +1,48 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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(projectId) { + // [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(); + + // project = 'my-project/*/locations/*' // Get the functions for a project. + async function listFunctions() { + const [functions] = await client.listFunctions({ + parent: `projects/${projectId}/locations/-`, + }); + console.info(functions); + } + listFunctions(); + // [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; +}); 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..f341c16be47 --- /dev/null +++ b/packages/google-cloud-functions/samples/test/quickstart.test.js @@ -0,0 +1,43 @@ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file 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 {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, '..'); + +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 ${projectId}`, {cwd}); + assert(stdout, stdout !== null); + }); +}); diff --git a/packages/google-cloud-functions/src/index.ts b/packages/google-cloud-functions/src/index.ts new file mode 100644 index 00000000000..ee0653e9ff7 --- /dev/null +++ b/packages/google-cloud-functions/src/index.ts @@ -0,0 +1,30 @@ +// 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'; +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, 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/v1/cloud_functions_service_client.ts b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts new file mode 100644 index 00000000000..ec50ac18f9a --- /dev/null +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client.ts @@ -0,0 +1,1972 @@ +// 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 type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * 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'; +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 _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}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + cloudFunctionsServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of 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/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}. + * @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, + gaxInstance?: typeof gax | typeof gax.fallback + ) { + // Ensure that options include all the required fields. + const staticMembers = this + .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 = + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // 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) { + 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 = { + 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, + // (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: '/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(lroOptions) + .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 = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.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, + 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 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 descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudFunctionsServiceStub; + } + + /** + * 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 [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 + ): Promise< + [ + protos.google.cloud.functions.v1.ICloudFunction, + protos.google.cloud.functions.v1.IGetFunctionRequest | undefined, + {} | undefined + ] + >; + getFunction( + request: protos.google.cloud.functions.v1.IGetFunctionRequest, + options: 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; + getFunction( + request?: protos.google.cloud.functions.v1.IGetFunctionRequest, + optionsOrCallback?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + 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 + ): Promise< + [ + protos.google.cloud.functions.v1.ICallFunctionResponse, + protos.google.cloud.functions.v1.ICallFunctionRequest | undefined, + {} | undefined + ] + >; + callFunction( + request: protos.google.cloud.functions.v1.ICallFunctionRequest, + options: 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; + callFunction( + request?: protos.google.cloud.functions.v1.ICallFunctionRequest, + optionsOrCallback?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.callFunction(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. + * * 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 {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. + * The first element of the array is an object representing [GenerateUploadUrlResponse]{@link google.cloud.functions.v1.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/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?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + 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 + ): Promise< + [ + protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, + protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | undefined, + {} | undefined + ] + >; + generateDownloadUrl( + request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + options: 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; + generateDownloadUrl( + request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, + optionsOrCallback?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + 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 {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. + * 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 + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + ] + >; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + resource: request.resource ?? '', + }); + this.initialize(); + 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`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + ] + >; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + resource: request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } + /** + * 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}. + * 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.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?: + | CallOptions + | Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + resource: request.resource ?? '', + }); + this.initialize(); + 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 + ): 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: 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.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, + optionsOrCallback?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + location: request.location ?? '', + }); + 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/v1/cloud_functions_service.create_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_CreateFunction_async + */ + async checkCreateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v1.CloudFunction, + protos.google.cloud.functions.v1.OperationMetadataV1 + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createFunction, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v1.CloudFunction, + 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. 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. + * 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 + ): 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: 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.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, + optionsOrCallback?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.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/v1/cloud_functions_service.update_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_UpdateFunction_async + */ + async checkUpdateFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.functions.v1.CloudFunction, + protos.google.cloud.functions.v1.OperationMetadataV1 + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateFunction, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.functions.v1.CloudFunction, + 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 + ): 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: 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.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, + optionsOrCallback?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.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/v1/cloud_functions_service.delete_function.js + * region_tag:cloudfunctions_v1_generated_CloudFunctionsService_DeleteFunction_async + */ + async checkDeleteFunctionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v1.OperationMetadataV1 + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.functions.v1.OperationMetadataV1 + >; + } + /** + * 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 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.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?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + 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 + * 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. + * 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, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.createStream( + this.innerApiCalls.listFunctions as 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 + * 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 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 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, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listFunctions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFunctions.asyncIterate( + this.innerApiCalls['listFunctions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cloudFunction resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} functionParam + * @returns {string} Resource name string. + */ + cloudFunctionPath(project: string, location: string, functionParam: string) { + return this.pathTemplates.cloudFunctionPathTemplate.render({ + project: project, + location: location, + function: functionParam, + }); + } + + /** + * 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 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. + * + * @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 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. + * + * 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.cloudFunctionsServiceStub && !this._terminated) { + return this.cloudFunctionsServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.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..d7b46e523f7 --- /dev/null +++ b/packages/google-cloud-functions/src/v1/cloud_functions_service_client_config.json @@ -0,0 +1,76 @@ +{ + "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": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetFunction": { + "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": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteFunction": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CallFunction": { + "timeout_millis": 600000, + "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/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/src/v1/index.ts b/packages/google-cloud-functions/src/v1/index.ts new file mode 100644 index 00000000000..6511c33a31e --- /dev/null +++ b/packages/google-cloud-functions/src/v1/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 {CloudFunctionsServiceClient} from './cloud_functions_service_client'; 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..e76de0b1b5d --- /dev/null +++ b/packages/google-cloud-functions/src/v2/function_service_client.ts @@ -0,0 +1,2432 @@ +// 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 type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * 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'; +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}. + * @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 = + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== '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 = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.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._opts.fallback + ); + + 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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createFunction, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateFunction, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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 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'] = + this._gaxModule.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 {}, + 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/src/v2alpha/function_service_client.ts b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts new file mode 100644 index 00000000000..f6cbbdde393 --- /dev/null +++ b/packages/google-cloud-functions/src/v2alpha/function_service_client.ts @@ -0,0 +1,2456 @@ +// 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 type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * 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'; +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/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}. + * @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 = + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== '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: '/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(lroOptions) + .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 = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.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._opts.fallback + ); + + 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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createFunction, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateFunction, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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 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'] = + this._gaxModule.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 {}, + 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..e9ec2bce7b0 --- /dev/null +++ b/packages/google-cloud-functions/src/v2beta/function_service_client.ts @@ -0,0 +1,2456 @@ +// 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 type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * 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'; +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/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}. + * @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 = + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== '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: '/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(lroOptions) + .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 = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.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._opts.fallback + ); + + 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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createFunction, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateFunction, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteFunction, + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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 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'] = + this._gaxModule.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 {}, + 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/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..d5ee6db257e --- /dev/null +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. ** + +/* 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..4bb11c8aa40 --- /dev/null +++ b/packages/google-cloud-functions/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,34 @@ +// 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 {CloudFunctionsServiceClient} from '@google-cloud/functions'; + +// check that the client class type name can be used +function doStuffWithCloudFunctionsServiceClient( + client: CloudFunctionsServiceClient +) { + client.close(); +} + +function main() { + // 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 new file mode 100644 index 00000000000..6dd1eaadafa --- /dev/null +++ b/packages/google-cloud-functions/system-test/install.ts @@ -0,0 +1,51 @@ +// 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 {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, + }; + await packNTest(options); + }); + + it('JavaScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, + }; + await packNTest(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 new file mode 100644 index 00000000000..b3267f13b8c --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_cloud_functions_service_v1.ts @@ -0,0 +1,2404 @@ +// 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 cloudfunctionsserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.CloudFunctionsServiceClient', () => { + 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 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 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(); + }); + }); + + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.IPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.setIamPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.IPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getIamPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = + stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.ITestIamPermissionsResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.testIamPermissions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = + new cloudfunctionsserviceModule.v1.CloudFunctionsServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CreateFunctionRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.CreateFunctionRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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 ??= {}; + 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() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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 ??= {}; + 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() + ); + 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); + 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 () => { + 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 ??= {}; + 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); + 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 () => { + 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 ??= {}; + 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, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v1.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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('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 = { + 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('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) + ); + }); + }); + }); +}); 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..5faa2a7645d --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_function_service_v2.ts @@ -0,0 +1,3152 @@ +// 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'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2.FunctionServiceClient', () => { + describe('Common methods', () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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 ??= {}; + 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() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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 ??= {}; + 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() + ); + 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); + 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 () => { + 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 ??= {}; + 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); + 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 () => { + 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 ??= {}; + 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, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + 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()), + generateSampleMessage(new protos.google.cloud.functions.v2.Function()), + ]; + client.innerApiCalls.listFunctions = stubSimpleCall(expectedResponse); + const [response] = await client.listFunctions(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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()), + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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()), + 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( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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()), + 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( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new 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) + ); + }); + }); + }); +}); 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..088c6c7c94c --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_function_service_v2alpha.ts @@ -0,0 +1,3176 @@ +// 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'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2alpha.FunctionServiceClient', () => { + describe('Common methods', () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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 ??= {}; + 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() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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 ??= {}; + 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() + ); + 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); + 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 () => { + 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 ??= {}; + 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); + 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 () => { + 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 ??= {}; + 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, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2alpha.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new 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..c314ec86fef --- /dev/null +++ b/packages/google-cloud-functions/test/gapic_function_service_v2beta.ts @@ -0,0 +1,3176 @@ +// 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'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v2beta.FunctionServiceClient', () => { + describe('Common methods', () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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() + ); + client.innerApiCalls.generateDownloadUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateDownloadUrl(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.CreateFunctionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.createFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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 ??= {}; + 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() + ); + client.innerApiCalls.updateFunction = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateFunction(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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 ??= {}; + 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() + ); + 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); + 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 () => { + 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 ??= {}; + 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); + 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 () => { + 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 ??= {}; + 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, + undefined, + expectedError + ); + const [operation] = await client.updateFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.functions.v2beta.DeleteFunctionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deleteFunction(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listFunctions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listFunctions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new 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) + ); + }); + }); + }); +}); 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..acc07c7f7af --- /dev/null +++ b/packages/google-cloud-functions/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: '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', +};